Systemd mounts

Author

Simone Massaro

Published

March 26, 2026

On a modern linux system systemd has it own way to mount disks that superseed the traditional /etc/fstab method.

The cool thing is that you can use all the niceties of systemd including having proper supports for secrets.

This is an example of how it works

# /etc/systemd/system/mnt-shares.mount
[Unit]
Description=UGent Network Share

[Mount]
What=//files.ugent.be/smassaro/shares
Where=/mnt/shares
Type=cifs
Options=credentials=%d/ugent-smb.cred,noperm,vers=3.11,sec=ntlmv2i
LoadCredentialEncrypted=ugent-smb.cred:/etc/credstore/ugent-smb.cred

[Install]
WantedBy=multi-user.target