Trying to mount /home directories to a NFS share.

SERVERURL:/nfstest    /home    nfs    vers=4,proto=tcp,intr,bg,rdirplus        0 0 

However, in syslog it says that it cannot resolve the address. I'm guessing it'll be OK if I used an IP Address, however this is not feasible due to our storage solution (IP addresses could change at a given moment).

If I mount manually with above in my fstab with the command:

mount -a

It manages to mount fine.

I've also tried creating a systemd service that will do the mount -a command after network is up, but i still get the same problem.

Tried numerous different mounting options, including _netdev.

All help would be greatly appreciated.

  • 18.04 resolves addresses with systemd-resolved listening on (see netstat -antup. And resolved get his forwarder from the NetworkManager active profile. See cat /var/run/NetworkManager/resolv.conf and cat /var/run/systemd/resolve/resolv.conf... I guess that dns resolution is not ready when the mount command starts. – cmak.fr Jun 11 '18 at 8:26
  • If you're willing to have the systemd service run the mount -a command, add a dependency (Wants/After) for network-online.target or NetworkManager-wait-online.service or similar, at which point nameserver configurations should be working. If hosting DNS you may also want to wait on bind9.service ... See this answer in Unix SE for more details or suggestions: unix.stackexchange.com/a/126146/18866 – Arkaine55 Jul 31 '19 at 3:45

To delay nfs mount until newtork is ready, add _netdev to option in the relevant entry in /etc/fstab. Like:

SERVERURL:/nfstest  /home nfs  vers=4,proto=tcp,intr,bg,rdirplus,_netdev  0 0

From mount(8) manpage:

_netdev The filesystem resides on a device that requires network access
(used to prevent the system from attempting to mount these filesystems 
until the network has been enabled on the system).
| improve this answer | |

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.