1

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.)

1

For automatically mounting NFS when present, autofs can be used (autofs)

As mentioned in man fstab(5)

nofail

do not report errors for this device if it does not exist.

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=

Configure how long systemd should wait for a device to show up before giving up on an entry from /etc/fstab. Specify a time in seconds or explicitly append a unit such as "s", "min", "h", "ms".

Note that this option can only be used in /etc/fstab, and will be ignored when part of the Options= setting in a unit file.

The default device timeout is 90 seconds, so a disconnected external device with only nofailwill make your boot take 90 seconds longer, unless you reconfigure the timeout as shown. Make sure not to set the timeout to 0, as this translates to infinite timeout.

| improve this answer | |
  • So I just add to my list of options in fstab so it now looks like this 10.0.0.2:/mnt/md0 /mnt/md0 nfs4 _netdev,noauto,nofail,x-systemd.device-timeout=1000ms 0 0. Is that right? – user3728501 May 25 at 13:30
  • This is fine currently, could you please check and share feedback? I also update the answer. – binarysta May 25 at 13:37
  • No problem I will update you on next boot – user3728501 May 25 at 15:00
  • Works as expected – user3728501 May 30 at 17:25

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.