Delay NFS Mount start up to allow network to initialize
On some newer and faster Linux boxes, the NFS network mount attempts to connect to drives before the network has fully initialised. To fix this we need to tell the server to pause for 30 seconds before attempting to mount the network shares.
Identifying the issue
While the server is booting watch the start up messages, just after network initialized, pay attention:
Starting system message bus: [ OK ] Starting Bluetooth Services: [ OK ] Mounting NFS filesystem: mount: mount to NFS server '10.10.0.21' failed: System Error: No route to host. [FAILED]
If you see it failed and "No route to host." then you have this issue.
The Fix
To fix this issue, edit the file /etc/init.d/netfs
:
- Locate the code block:
# Let udev handle any backlog before trying to mount file systems /sbin/udevsettle --timeout=30 [ -n "$NFSFSTAB" ] && { [ ! -f /var/lock/subsys/portmap ] && service portmap start action $"Mounting NFS filesystems: " mount -a -t nfs,nfs4 }
- The easiest way is to search for
portmap start
- Immediately after the line:
[ ! -f /var/lock/subsys/portmap ] && service portmap start
- Add the following code:
action $"Sleeping for 30 seconds..." sleep 30
- The code block should now look like:
# Let udev handle any backlog before trying to mount file systems /sbin/udevsettle --timeout=30 [ -n "$NFSFSTAB" ] && { [ ! -f /var/lock/subsys/portmap ] && service portmap start action $"Sleeping for 30 seconds..." sleep 30 action $"Mounting NFS filesystems: " mount -a -t nfs,nfs4 }
- Reboot the server and verify the mounts now connect at boot!