In https://askubuntu.com/a/119818/5032 qbi says:
add noauto to your fstab:
...
So the filesystem will not automatically mounted at startup. Furthermore you write a script which basically mounts your mhddfs and add it at some late point in the boot process.
But how do you do this? My mergerfs never mounts all of its drives at startup, presumably because they aren't mounted before it? It's the last entry in fstab, like this (but with more drives):
/mnt/EXT4_drive/drivepool:/mnt/NTFS_drive/drivepool:/mnt/anotherdrive/drivepool /mnt/drivepool fuse.mergerfs defaults,allow_other,minfreespace=100M 0 0
When I run df
after boot, the drive name only shows some of the mount points are included, and a fraction of the space it should have with all of them, so they aren't included if they aren't ready? I have to manually run sudo umount /mnt/drivepool ; sudo mount /mnt/drivepool
after boot to fix it and show all of them.
Also computer has more than once booted into "Welcome to emergency mode!" when one of the drives was being automatically fscked while it tried to mount /mnt/drivepool
. This hasn't happened lately, maybe because of a change in mergerfs that lets it ignore not-ready drives instead of halting because of them?
How would I automatically mount /mnt/drivepool
ASAP after everything else in fstab has successfully mounted and fscked?
Ok so after lots of reading:
Since Ubuntu 15.04,
fstab
entries are converted intosystemd
units (*.mount
files found under/run/systemd/generator
) bysystemd-fstab-generator
and are then mounted in no particular order, which is why mine was failing.However
systemd
supports dependencies, and these can be specified using the fstab optionx-systemd.requires
.So for each prerequisite mount, you add a separate entry to the fstab mount, and it understands path names:
In my first attempt, I left out a
/mnt/
and my computer refused to boot and became read-only. ಠ_ಠ To prevent this, you should also addnofail
. This makes the mount point a "want" forlocal-fs.target
instead of a "requires", so the computer will still boot if it fails.Then when you do
mount -a
it will complain aboutbut it still works anyway. ಠ_ಠ
Here's my complete fstab line, which has worked every time since I changed it: