I have a Debian 10 machine which has a nfs
mountpoint specified in fstab.
This is the line
10.0.0.2:/mnt/md0 /mnt/md0 nfs4 _netdev,auto,nofail 0 0
I thought nofail
would prevent my boot sequence hanging for (precicely) 1:32 while a time out takes place while the system is looking for the nfs drive. However this doesn't appear to be the correct opion, as it is not mentioned in my systems man pages. A search suggested nobootwait
might be an alternative but again this is not mentioned in the man pages. There doesn't appear to be any relevant option, unless I am looking in the wrong document?
Is there any way to specify that the drive should be automatically mounted, when it is present, and only when it is present. Both at boot time, and additionally, if the drive is "somehow seen" later on.
eg; If I boot my workstation, and the drive is not present (server not booted) it should not wait an additional minute and a half to boot.
then; If I boot the server at a later time, is there any way to automatically detect/mount the nfs drive? I guess this could be done with some kind of cron script which pings the network address 10.0.0.2
? (My server IP.)
Best Answer
For automatically mounting NFS when present,
autofs
can be used (autofs)As mentioned in
man
fstab(5)nofail
AFAIK nobootwait was only for ubuntu-based distros (which is not a valid option anymore)
You can use
x-systemd.device-timeout=
(more info systemd.mount)x-systemd.device-timeout=
The default device timeout is 90 seconds, so a disconnected external device with only
nofail
will make your boot take 90 seconds longer, unless you reconfigure the timeout as shown. Make sure not to set the timeout to0
, as this translates to infinite timeout.