Let your computer continue to boot even if it can’t mount something in fstab

I have a Drobo, basically a consumer grade NAS or network file share device, that I store the majority of my media and documents on. The files are accessed via an exposed Windows share folder and because Linux doesn’t always play the nicest with that I’ve taken to force mounting these shares on my machine via fstab. The usual approach is to add something like this to your /etc/fstab file:

//{IP address of server}/Media /media/Drobo/Media cifs guest,uid=1000,iocharset=utf8 0 0

I won’t get into all of the gory details here (for that see this older post) but essentially this tells the computer to map the shared Media folder on my Drobo to a location on my computer under /media/Drobo/Media. The problem with this approach is that if the Drobo is offline or if there is a network problem then it will cause the boot process to pause with an error and prompt me if I want to continue without mounting it. While this is fine it isn’t always ideal. For instance what if I wanted to do something similar with my laptop but not have to go through the hassle of OKing the boot every time it failed to find the Drobo when I’m away from home? Well thankfully there are a few more switches we can add to the fstab line to do just that!

Here is what my new fstab line looks like:

//{IP address of server}/Media /media/Drobo/Media cifs nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=10,guest,uid=1000,iocharset=utf8 0 0

I’ve bolded the new portion but it should be fairly obvious what is happening here. Basically the nofail option says “I don’t care if you can’t mount it, don’t stop with an error just keep going” where the other options specify requirements to even try such as network connectivity as well as a timeout value so I don’t have to wait long for it to realize that it can’t find the Drobo. With these added options I can easily boot with or without the Drobo being there and I’m never prompted with an error message.

Now a few things to note:

  • Adding nofail to devices you do need to mount, such as your root drive, is probably a terrible idea.
  • If the computer boots up when the Drobo isn’t there but later I bring the computer back to the network where the Drobo lives, it won’t automatically find and mount it for me. So that’s something you’ll still need to remember to do manually (by running sudo mount -a or something like that).



2 Comments

  1. You might want to take a shot at using autofs. It will spare you any trouble with availability during boot up but allow your files to be accessible when you need them.

3 Trackbacks / Pingbacks

  1. Quickies: continue booting with inaccessible resource (fstab) | 0ddn1x: tricks with *nix
  2. Quickies: continue booting with an inaccessible resource (fstab) | 0ddn1x: tricks with *nix
  3. The Linux Experiment Post Roundup (October 2017) | Tyler Burton

Leave a Reply

Your email address will not be published.


*