93

In this question I asked how to prevent a media failure from halting the system boot process. However, I got two suggestions for /etc/fstab options

  • nobootwait
  • nofail

What is the difference between the two?

Evan Carroll
  • 30,763
  • 48
  • 183
  • 315

5 Answers5

70

Firstly nofail allows the boot sequence to continue even if the drive fails to mount.

This is what fstab(5) says about nobootwait

The mountall(8) program that mounts filesystem during boot also recognises additional options that the ordinary mount(8) tool does not. These are:

  • bootwait which can be applied to remote filesystems mounted outside of /usr or /var, without which mountall(8) would not hold up the boot for these;

  • nobootwait which can be applied to non-remote filesystems to explicitly instruct mountall(8) not to hold up the boot for them;

  • optional which causes the entry to be ignored if the filesystem type is not known at boot time; and

  • showthrough which permits a mountpoint to be mounted before its parent mountpoint (this latter should be used carefully, as it can cause boot hangs).

fstab(5) has this to say about nofail

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

Evan Carroll
  • 30,763
  • 48
  • 183
  • 315
  • 7
    Note that mountall and those options are ubuntu (and its derivatives) specific (and only relatively recent versions where upstart and that mountall was introduced. – Stéphane Chazelas Nov 30 '12 at 22:36
  • 19
    nobootwait is no longer a valid option in Ubuntu 16.04 (as of 2016-07-10 testing Mythbuntu install/live-DVD). – Kingsley Jul 12 '16 at 02:42
  • 2
    External devices that are to be mounted when present but ignored if absent may require the nofail option. This prevents errors being reported at boot. – endolith Sep 23 '16 at 14:14
  • EvanCarroll: Can you address @endolith's comment? – user541686 Jul 07 '17 at 12:29
  • @Mehrdad They're not my definitions. They're cited definitions, I have no control over them. My statement is that "nofail does not permit the boot sequence to continue if the drive fails to mount." You can see the example that caused this investigation here. – Evan Carroll Jul 07 '17 at 14:53
  • @EvanCarroll: Could you provide a link to them? It's not clear to me where you might have pulled these from... – user541686 Jul 08 '17 at 04:31
  • 2
    i say quite explicitly fstab(5). So man 5 fstab – Evan Carroll Jul 08 '17 at 04:32
  • 1
    @EvanCarroll which distribution did you look up man 5 fstab on? E.g. Ubuntu 16 LTS does not mention nobootwait or bootwait at all. – ILIV Dec 20 '17 at 06:48
  • @ILIV http://manpages.ubuntu.com/manpages/trusty/man5/fstab.5.html not sure if it was a sysv or ubuntu patch or what. – Evan Carroll Dec 20 '17 at 06:57
  • 1
    I see, that's Ubuntu 14 (Trusty). Thank you @EvanCarroll. Just to confirm what Kingsley said above bootwait/nobootwait is no longer supported on Ubuntu 16 LTS. Only nofail. – ILIV Dec 20 '17 at 07:00
  • When I tried to use nofail I got unrecognized option errors=nofail – Aaron Franke Jan 26 '19 at 07:24
38

Since this old question has a high Google rating, I'll mention that since "nobootwait" doesn't work with systemd, the correct method is to set a short timeout of, say, 9 seconds with "x-systemd.device-timeout".

e.g.:

/dev/sda2  /mnt/other  auto  defaults,nofail,x-systemd.device-timeout=9  0  2

(Edit: I've increased the timeout from 3s to 9s because it seems that Ubuntu occasionally does a quick filesystem-check on bootup that can last longer than 3s.)

Enrico
  • 344
  • 3
  • 9
Dave Rove
  • 1,315
31

As mentioned by Stéphane, nobootwait is limited to ubuntu+derivatives.

Nofail will keep trying to mount the drive as cjm pointed out, however, the boot process will continue after the mount reaches timeout. If you don't expect the drive to be there regularly as to warrant the extra 90 seconds or so bootup when it's absent, don't automount it in fstab.

(P.S. I put this as cjm's answer sounds as if the system will ultimately fail to boot).

TNT
  • 411
6

This article seems to explain the difference well.

mountall tries to automount all entries from fstab that have the defaults or auto mount options. It will halt the boot process if such entries cannot be mounted, except when the mount option nobootwait is given.

fsck tries to do a filesystem check on all entries from fstab that have the sixth field set to 1 or 2. Non-critical drives typically have this field set to 2. It will halt the boot process if such filesystems cannot be checked, except when the mount option nofail is given.

Disclaimer: I am not a fstab expert and cannot guarantee/verify the above information to be true. All credits belong to the author of that article.

karel
  • 2,030
  • When I tried to use nofail I got unrecognized option errors=nofail – Aaron Franke Jan 26 '19 at 07:24
  • 1
    Article seems to be dead. Here's a link to archived version: https://web.archive.org/web/20170707005942/http://techmonks.net/nofail-and-nobootwait-mount-options-in-fstab-prevent-boot-problems/ – Mikko Rantalainen Aug 14 '20 at 12:19
0

In my case, below are the mount options added into the ubuntu-20.4 /etc/fstab file. I was able to mount without any error.

UUID=297e42c4-436d-4218-953e-f2681ff7df8c /raid  ext4    errors=remount-ro,nofail  0   1   
Greenonline
  • 1,851
  • 7
  • 17
  • 23