mount nfs and unmount


服务器端

服务器端的安装
sudo apt update
sudo apt install nfs-kernel-server

配置共享文件夹和访问权限等, ip是运行访问的客户IP
sudo vim /etc/exports
/mnt/myfolder  172.16.0.1(rw,sync,no_subtree_check)


查看共享文件夹
sudo exportfs -rv

修改/etc/exports之后,需要重启服务。
sudo systemctl restart nfs-kernel-server



客户端:


客户端的安装
sudo apt update
sudo apt install nfs-common


mount 局域网的nfs
sudo mount -t nfs 172.16.16.15:/mnt/myfolder /mnt/myfolder -o nolock

永久mount,在/etc/fstab里面增加命令:
172.16.16.15:/mnt/myfolder /mnt/myfolder nfs defaults 1 1

取消mount
sudo   umount -f -l /mnt/myfolder

https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-22-04
阅读量: 249
发布于:
修改于: