nofail and nobootwait mount options in fstab prevent boot problems
Source: Wooden Drives Icons set by Teijo Räty.
Problem description: You (re)boot your computer, e.g. a headless server. The boot process can halt or exit to rescue mode when an external disk is unavailable or when an internal but non-critical disk is out of order.
- 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.
A possible disadvantage of nobootwait is that, if the disk is actually present, it will do the filecheck in the background and continue booting. That might be exactly what you want for e.g. external drives, but if other services depend on the drive, then those services can fail.
Another disadvantage of nobootwait is the fact that it is not supported by all Linux distributions. For example, using Scientific Linux (RHEL) 6.4, I cannot mount a partition that has the nobootwait set in fstab.
According to the fsck man page, this is what nofail does:
fsck normally does not check whether the device actually exists before calling a file system specific checker. Therefore non-existing devices may cause the system to enter file system repair mode during boot if the filesystem specific checker returns a fatal error. The /etc/fstab mount option nofail may be used to have fsck skip non-existing devices. fsck also skips non-existing devices that have the special file system type auto
Ubuntu has a bug listed: “mountall ignores nofail mount option”. That makes sense, as mountall has not implemented nofail. It uses nobootwait. The bug reporters argue that both mountall and fsck should make use of the nofail option, and I agree with them.
So, if you want to be on the safe side, you
- should use both nobootwait and nofail.
- should test this with a manual umount followed by a mount.
- should have no services depending on non-critial disks.
Below an example from my own SE 6.4 server using only the nofail option, because mounting with the nobootwait option present gives an error.
LABEL=Series /mnt/filer/Series xfs auto,nofail,nodev,noexec,nouser,noatime 0 2
- ArchWiki entry on fstab (2013-08-29)
- nofail option in /et/fstab (Holger, 2008-12-25)
- fsck man page (fsck from util-linux-ng 2.17.2, 2009-02, Scientific Linux / RHEL 6.4)
- mountall ignores nofail mount option (Ubuntu bugs #610869)
Deze blogpost werd in december 2022 overgezet van WordPress naar een methode gebaseerd op Markdown; het is mogelijk dat hierbij fouten of wijzigingen zijn ontstaan t.o.v. de originele blogpost.