Setup NFS client (nfs-utils)

nfs客户端通过mount实现连接服务器

下载安装nfs-utils

1
yum install nfs-utils

确认

1
2
3
[root@client ~]# showmount -e 192.168.64.48
Export list for 192.168.64.48:
/tmp/nfs 192.168.64.0/22

挂载锚点

1
2
3
mount -t nfs 192.168.64.48:/tmp/nfs /mnt

df -hT

Automatically mount by using autofs

One drawback of using /etc/fstab is that, regardless of how infrequently a user accesses the NFS mounted file system, the system must dedicate resources to keep the mounted file system in place. This is not a problem with one or two mounts, but when the system is maintaining mounts to many systems at one time, overall system performance can be affected.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/nfs-autofs

Step1. Install autofs

1
2
dnf -y install autofs
systemctl enable autofs

Step2. Edit auto.master for direct mapping

1
2
3
vim /etc/auto.master
#/misc /etc/auto.misc
/- /etc/auto.misc

Step3. Edit auto.misc

1
2
vim /etc/auto.misc
/share -fstype=nfs4,rw 192.168.65.129:/share

Step4. Restart autofs to apply the changes

systemctl restart autofs