Skip to contentSkip to conversation

mount: "nofail" option does not seem to work as expected

DISCUSSION Patrick McLean 2 participants 2 messages Mar 24, 2014 – Apr 7, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

First the "nofail" doesn't actually prevent "failure" when using "mount -a". If any filesystem fails to mount with mount -a due to the device not existing, even if "nofail" is specified in the mount, mount will exit with a status of 32. I would expect that "nofail" would imply that such failures would cause the exit status to be 0.

Also, it seems that the "nofail" mount option does not work at all when using the tag-style partition identifiers rather than udev symlinks.

Using this line in fstab:
UUID=nonexist /mnt/nonexist1 ext4 nofail 0 1

Will produce an error message:

# mount -av
mount: can't find UUID=nonexist
#

Where this line:
/dev/disk/by-uuid/nonexist /mnt/nonexist ext4 nofail 0 1

Does not produce any error:

# mount -av
#
maintainer
#1 lore raw
Quoted 17 lines · Patrick McLean

First the "nofail" doesn't actually prevent "failure" when using "mount -a". If any filesystem fails to mount with mount -a due to the device not existing, even if "nofail" is specified in the mount, mount will exit with a status of 32. I would expect that "nofail" would imply that such failures would cause the exit status to be 0.

Also, it seems that the "nofail" mount option does not work at all when using the tag-style partition identifiers rather than udev symlinks.

Using this line in fstab:
UUID=nonexist /mnt/nonexist1 ext4 nofail 0 1

Will produce an error message:

# mount -av
mount: can't find UUID=nonexist
#
Quoted 5 lines

Where this line:
/dev/disk/by-uuid/nonexist /mnt/nonexist ext4 nofail 0 1

Does not produce any error:

# mount -av

Excellent catch, thanks!

Fixed and will be in v2.24.2.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com