Linux – fstab on boot: mount when device is plugged in


I have an external USB drive which I want to be mounted automatically on boot when it is plugged in. With the current settings in fstab, mount will try to mount it even when it is not available, which produces a filesystem error. Is there an option for an fstab entry to declare that it should be mounted only when available? My current entry is as follows:

UUID=myawesomeid /media/usb1 ext3 rw,async,user,auto 0 2

Best Answer

  • You want the nofail mount option.

    man mount

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

  • Related Question