3

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

/etc/systemd/system/local-fs.target.d/nofail.conf 

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

is there something else i can do to stop this happening

Thanks

user386101
  • 33
  • 3
  • 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 06 '18 at 16:36
  • Sorry, i had added the [Unit] heading but it still failed – user386101 Feb 07 '18 at 18:03

2 Answers2

2

Add the nofail option to your /etc/fstab:

/dev/sdb1 /user_data xfs rw,nofail 0 0
JRFerguson
  • 14,570
  • 3
  • 34
  • 40
  • 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 06 '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 05 '18 at 16:12
0

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.

sourcejedi
  • 48,311
  • 17
  • 143
  • 296