nfs entry in /etc/fstab fails but manually mounting works

可紊 提交于 2020-03-23 08:23:16

问题


Client is Ubuntu Xenial, manually mounting works just fine:

mount 10.0.0.12:/mnt/d1 /mnt/d1

I then copy that line from /etc/mtab to /etc/fstab:

10.0.0.12:/mnt/d1 /mnt/d1 nfs4 user,rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.23,local_lock=none,addr=10.0.0.12 0 0

umount /mnt/d1

and then mount it again using fstab:

mount /mnt/d1

and it times out at that time.

The nfs server is centos7

Updated firewalld:

firewall-cmd --permanent --zone=public --add-service=nfs

and reloaded, with /etc/exports like so:

/mnt/d1           10.0.0.0/24(rw,sync,no_subtree_check)

回答1:


It turns out that there are a few other firewall ports to enable:

firewall-cmd --permanent --zone=public --add-service=mountd
firewall-cmd --permanent --zone=public --add-service=rpc-bind

Go ahead and ensure all services are enabled too:

systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap

And check the perms on your mount point:

ls -lh /mnt


来源:https://stackoverflow.com/questions/51115091/nfs-entry-in-etc-fstab-fails-but-manually-mounting-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!