Best way to automount ext4 SSD

Oh PLEASE stop with the advise with fstab
:point_down:

If you read carefully, I can’t quote cause its been a while since i read that page, it should tell you what file systems can cause problems with discard…


Example: for the OP how easy it is:

$ sc-cat mnt-LutrisGames.{,auto}mount | xc

# /etc/systemd/system/mnt-LutrisGames.mount
[Unit]
Description=Lutris-Gamelib
Documentation=man:systemd.mount(5)
Documentation=man:systemd.automount(5)
After=dev-disk-by\x2dlabel-Backups.device
BindsTo=dev-disk-by\x2dlabel-Backups.device
RefuseManualStart=yes
RefuseManualStop=yes

[Mount]
What=/dev/disk/by-label/Backups
Type=btrfs
Options=noatime,subvol=/@LutrisGames

# /etc/systemd/system/mnt-LutrisGames.automount
[Unit]
Description=Lutris-Gamelib
Documentation=man:systemd.mount(5)
Documentation=man:systemd.automount(5)
PartOf=Gameing-Mounts.service

[Automount]
TimeoutIdleSec=5min

# Autostarted by Gameing-Mounts.service
# [Install]
# WantedBy=graphical.target

The above uses Filesystem LABEL but you can use UUID’s also ofcourse.
Plus the above is started using a service that pulls in other automount units also, just to make it easy to start/stop related mounts for gaming in my example…