↓ Skip to main content

Mount NFS share as systemd service

·55 words·1 min

Mount NFS share in SteamOS that survives system updates

# /etc/systemd/system/var-mnt-nas-public.automount
[Unit]
Description=NAS public automount

[Automount]
Where=/var/mnt/nas/public
TimeoutIdleSec=600

[Install]
WantedBy=multi-user.target
#/etc/systemd/system/var-mnt-nas-public.mount
[Unit]
Description=NAS public
After=network-online.target
Wants=network-online.target

[Mount]
What=192.168.88.23:/share/media/public
Where=/var/mnt/nas/public
Type=nfs4
Options=vers=4.2,hard,nconnect=4,noatime,rsize=1048576,wsize=1048576
Important

File names for mount and automount services must correspond to the mount path.

Then run

sudo systemctl daemon-reload
sudo systemctl enable --now var-mnt-nas-public.automount