And there it is. The year 2018! And the most important thing was – „Is it possible to boot without fstab, but with systemd only?“.

tl;dr
Yes it is!

  • is it worth it?
    • Nope
  • do I recommend it?
    • Nope
  • will I keep it?
    • No, I’ll use my fstab for /, but I’ll leave /home and the rest as systemd mount units only (:

So how to do that. thats just easy. For every partition/mount in your /etc/fstab, you need to create a *.mount file. Tha mount file must be placed in /etc/systemd/system/ and its important to name them after the mountpoint. So if you want to mount something at /home/share, the filename has to be „home-share.mount

Lets look at the content, inside:

[Unit]
Description=Mount /home/share directory

[Mount]
What=/dev/disk/by-uuid/544c6018-0fd6-47f2-9a4b-b9a70b9c9aa7
Where=/home/share
Type=ext4
Options=rw,relatime,data=ordered

[Install]
WantedBy=local-fs.target

Like you can see, its the same as you have in your fstab. Just a bit easier to read. What=  needs to device. I’m using the uuid, because thats the most save. You could also use „/dev/sda2“ or something else if you want to.

When thats written and saved, just do a

systemctl enable --now home-share.mount

and you’re done!

for the swapfile its about the same, but the name has to end with *.swap instead of .mount.

[Unit]
Description=Turn on swap

[Swap]
What=/swapfile

[Install]
WantedBy=local-fs.target

and

systemctl enable --now swapfile.swap

done! It’s really easy!

My biggest problem was to root filesystem. You don’t need to create a mount unit for this one. 😀

Now you can comment your stuff in your fstab, your system will still boot without it (if you’ve done right)