19763 shaares
136 private links
136 private links
After RTFM’ing, I realized, under the hood, systemd just runs mount command to mount the specified partition with the specified mount options listed in the mount unit file. Basically, you need to specify the following options in your unit file:
What= a partition name, path or UUID to mount
Where= an absolute path of a directory i.e. path to a mount point. If the mount point is non-existent, it will be created
Type= file system type. In most cases mount command auto-detects the file system
Options= Mount options to use when mounting
In the end, you can convert your typical fstab entry such as this:
UUID=86fef3b2-bdc9-47fa-bbb1-4e528a89d222 /mnt/backups ext4 defaults 0 0
to:
[Mount]
What=/dev/disk/by-uuid/86fef3b2-bdc9-47fa-bbb1-4e528a89d222
Where=/mnt/backups
Type=ext4
Options=defaults