Auto Mount with SystemD

This shows how to automount remote network drives using systemd and fstab

Automount using systemd

Sometimes partitions can fail to mount on startup and some options are needed to fix this. I’ve had two instances where it was needed. One was on a slow 6 TB drive that timed out on occation during boot and I had to sudo mount -a to get it to mount

For this a simple option addition in fstab on a local disk looks like this:

x-systemd.after=network-online.target,x-systemd.automount

Next, I had problems with NFS shares not mounting and I had to expand these option to:

x-systemd.after=network-online.target,x-systemd.automount,x-systemd.mount-timeout=30,_netdev

This makes the /etc/fstab entry look like this:

10.0.0.10:/volume2/Images		/media/images	nfs	x-systemd.after=network-online.target,x-systemd.automount,x-systemd.mount-timeout=30,_netdev	0	0

Source: https://wiki.archlinux.org/title/Fstab#Automount_with_systemd