18

Can I set an /etc/fstab with options=auto to be skipped if mounting fails?

The manual says, it will break the boot process if an entry with options=auto fails.

Without auto, it does not automatically mount the device on boot.

So how to make the auto entry to be ignored on failures?

1
15

I created a partition called /dev/sdb1 in my Ubuntu VM. But I didn’t create a filesystem for this partition and so of course it will not get mounted.

Then put following entry in fstab.

/dev/sdb1   /mnt/       auto    defaults,nobootwait     0   2

And rebooted VM. Server got rebooted with following error msg in syslog

suku@ubuntu-vm:~$ grep sdb1 /var/log/syslog
Jan 11 16:32:58 ubuntu-vm kernel: [    2.263540]  sdb: sdb1
Jan 11 16:32:59 ubuntu-vm kernel: [    4.403527] EXT3-fs (sdb1): error: can't find ext3 filesystem on dev sdb1.
Jan 11 16:32:59 ubuntu-vm kernel: [    4.410341] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
Jan 11 16:32:59 ubuntu-vm kernel: [    4.413978] FAT-fs (sdb1): bogus number of reserved sectors
Jan 11 16:32:59 ubuntu-vm kernel: [    4.414073] FAT-fs (sdb1): Can't find a valid FAT filesystem

What is nobootwait:

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

4
  • 5
    nobootwait doesn't work any longer in 16.04 – Antti Haapala Jan 9 '17 at 12:25
  • 2
    On rhel/centos 7, the nofail flag works – Andy Feb 12 '18 at 18:25
  • 1
    What is the correct flag to use on Ubuntu 18.04? – Aaron Franke Jan 26 '19 at 7:01
  • @AaronFranke , try: nofail,errors=continue – Vasin Yuriy Jan 1 '20 at 10:31
2

Maybe it will be better to write a script to mount something after boot? For example, put string with noauto to fstab and mount it via rc.local

1

For some flavors nobootwait and for for example xfs file systems no work

Below work with UUID

UUID=718ef17e-5502-4a74-81fe-930d21f5507d /data xfs rw,noquota,nofail  0 2
0

I am not sure about your distro, but usually booting just waits with a timeout and then will boot without mounting. You can mount it automatically on run time using an udev rule, e.g. on pluggin in.

To bind directories in fstab use:

/from    /to   none bind 0 0 
4
  • debian 6 and it's a mount --bind dirA directoryB that i'd like to automate. – ledy Jan 11 '13 at 10:22
  • @Steffen grub is never involved with fstab at run time. – rackandboneman Jan 11 '13 at 10:38
  • @ledy: Did you try to bind in fstab with e.g. /opt/var_log /var/log none bind 0 0? Also you could consider to place a symlink. – Steffen Jan 11 '13 at 12:04
  • You should definitely edit your post since grub has absolutely nothing to do with mounting. – chutz Jan 11 '13 at 13:28

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.