1

I have a CentOS 7 x64 server which doesn't mount NFS entries in /etc/fstab on boot. The configuration is correct, because if I run mount -a, everything works like a charm. The fstab entries are as such.

10.0.0.61:/vault/enterprise     /usr/www/vault  nfs     rw      0       0
10.0.0.61:/vault/files          /usr/www/files  nfs     rw      0       0
10.0.0.61:/vault/data           /usr/data       nfs     rw      0       0

Originally I was a freebsd admin. I had no trouble getting the shares to work, but I'm not understanding why they don't work on boot. Could iDRAC on the server be interfering? Does the VIP I have on loopback have anything to do with it? I'm at a total loss.

  • The fstab entries look correct. Are there are any errors in the system journal when systemd tries to mount the shares? journalctl -b will show you the logs for the current boot. – Mike Shoup Jun 12 '15 at 3:18
  • I did check the logs, and it looks like it's not waiting for the network to come on line even though the manual seems to suggest that it should be doing so. – spuy767 Jun 12 '15 at 10:28
2

You need to be using _netdev in your mount options. This will cause the mount to happen AFTER netwokring finishes initializing, rather than potentially before (as with local disks).

Also, seriously look at using autofs to mount NFS and other network based filesystems. It behaves much better and needs much less attention than using the fstab to mount volumes that are more dynamic in nature (and volumes that are subject to periodic disconnection). Specifically, autofs will mount a given volume upon access, rather than at boot. It will also remount it automatically in case fo failure.

  • I had long sorted this out with a systemd tweak, but I'll mark this as the accepted answer because I did not know about autofs and it worked without any configuration tweaking. – spuy767 Sep 26 '16 at 13:42
  • 1
    @spuy767 Would you mind sharing what systemd tweak you're referring to for postarity? TIA! – Jordan Nov 15 '18 at 2:19
1

It's seems like You have to add auto option. As example

10.0.0.61:/vault/data    /usr/data   nfs      _netdev,defaults,user,auto,noatime,intr   0 0
  • I read somewhere that auto didn't have any affect, but I'll give it a shot. – spuy767 Jun 11 '15 at 10:31
  • Still doesn't mount on boot. – spuy767 Jun 11 '15 at 11:14
1

Chances are you probably do not have your nfs service enabled on boot. By default the _netdev option does not mount the device at all, even after the network is up. Try setting your nfs service to enabled so it starts on boot.

systemctl enable nfs.service

systemctl start nfs.service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.