I have added this entry to my /etc/fstab

/dev/sdb1 /user_data xfs rw 0 0

Which works fine, the issue i am getting it sometime i remove this drive and when i do and reboot my machine it goes into emergency mode.

I have tried adding


with OnFailure= in it but i still get the same result

is there something else i can do to stop this happening


  • If the file only has OnFailure= in it, I think you are missing the [Unit] heading. If you just run systemctl daemon-reload after the system booted succesfully and check journalctl -b... or alternatively, boot with printk.devkmsg=on and check journalctl -b or dmesg... do you see systemd reporting any warnings parsing your drop-in config file? You can also look at systemctl show local-fs.target | grep OnFailure – sourcejedi Feb 6 '18 at 16:36
  • Sorry, i had added the [Unit] heading but it still failed – user386101 Feb 7 '18 at 18:03

Add the nofail option to your /etc/fstab:

/dev/sdb1 /user_data xfs rw,nofail 0 0
  • My understanding was that on its own, this waits 90 seconds for the device to appear before continuing with the boot process, and this is usually longer than desired. editted to add: To be fair, the same would apply if you allowed local-fs.target to fail, without switching the system to emergency mode. – sourcejedi Feb 6 '18 at 16:39
  • @sourcejedi: Absence of the nofail option when the device is not present at boot time yields outcomes that vary from system to system. For example, on Raspbian, the boot process may halt indefinitely, and in fact it does halt indefinitely in some cases. Smells like a bug, but in any case, the documentation (man fstab, man mount) is misleading in at least some cases. – Seamus Aug 5 '18 at 16:12

The options noauto,x-systemd.automount (in place of rw, which is enabled by default) can be used to attempt to mount the disk only when /user_data is accessed. I do not know whether fsck is invoked first, however.

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.