So, I setup few SBCs (Raspberry Pi, Orange Pi) as mini-servers for many kind of purpose at home. One of them is a media-server, it is plugged into multiple removable drives (few USB sticks and one 3TB self-powered seagate 3.5″ enclosure).
I setup the drive to auto-mount on boot using fstab
.
One day, because I use one of the USB stick, it stopped working. It seems that the system check and wait for the missing drive (since it’s declared explicitly on fstab)
UUID=XXXX-XXXX / ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,nosuid 0 0
/var/swap none swap sw 0 0
UUID="XXXX-XXXX" /mnt/usb auto user,umask=000,utf80 0
UUID="XXXX-XXXX" /mnt/hdd exfat defaults,auto,umask=000,users,rw 0 0
The fix is to add nofail
option to your fstab
entry. Refer to man systemd.mount
nofail
With nofail, this mount will be only wanted, not required, by local-fs.target or remote-fs.target. This
means that the boot will continue even if this mount point is not mounted successfully.
So my fstab
entry modified into:
UUID=XXXX-XXXX / ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,nosuid 0 0
/var/swap none swap sw 0 0
UUID="XXXX-XXXX" /mnt/usb auto user,umask=000,utf80,nofail 0
UUID="XXXX-XXXX" /mnt/hdd exfat defaults,auto,umask=000,users,rw,nofail 0 0
Now I can freely remove the removable drive without causing boot to stuck.