CentOS 7 NFS partition doesn't mount on boot

13,058

Solution 1

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.

Solution 2

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

Solution 3

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
Share:
13,058

Related videos on Youtube

spuy767
Author by

spuy767

Updated on September 18, 2022

Comments

  • spuy767
    spuy767 over 1 year

    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.

    • Mike Shoup
      Mike Shoup almost 9 years
      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.
    • spuy767
      spuy767 almost 9 years
      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
    spuy767 almost 9 years
    I read somewhere that auto didn't have any affect, but I'll give it a shot.
  • spuy767
    spuy767 almost 9 years
    Still doesn't mount on boot.
  • spuy767
    spuy767 over 7 years
    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.
  • Jordan
    Jordan over 5 years
    @spuy767 Would you mind sharing what systemd tweak you're referring to for postarity? TIA!
  • starbeamrainbowlabs
    starbeamrainbowlabs almost 4 years
    Failed to enable unit: Unit file nfs.service does not exist. on Raspbian 10 Buster :-/