Linux clients often need an NFS directory to appear at a stable local path without forcing the remote server to answer during early boot. A systemd automount keeps the path available and waits until a process opens it before starting the real network mount.
The fstab method keeps the configuration in /etc/fstab while letting systemd generate the matching .automount and .mount units. The generated automount unit watches the local path, while the generated mount unit keeps the server export, filesystem type, timeout, and network-ordering options.
Start from a manual mount that already works from the client. The finished setup is ready when the fstab entry has no parse errors, the automount unit is active and waiting, the first directory access starts the mount unit, and the live mount table shows the expected NFS source.
Related: How to mount an NFS export on Linux
Related: How to automount an NFS export with autofs
Related: How to create a systemd automount unit
$ sudo apt install --assume-yes nfs-common
Use sudo dnf install nfs-utils on RHEL, CentOS Stream, Fedora, and compatible systems.
$ showmount --exports files.example.net Export list for files.example.net: /srv/nfs/projects 192.0.2.0/24
Some NFSv4-only servers do not answer showmount because they do not expose the legacy mount service. If the server owner provided the exact export path, test the mount directly and compare any failure with the server-side export table.
Related: How to list NFS exports from a client
Related: How to list NFS exports on a server
$ sudo mkdir --parents /mnt/projects
Files already inside /mnt/projects become hidden while the NFS filesystem is mounted there.
$ sudo mount -t nfs4 files.example.net:/srv/nfs/projects /mnt/projects
Use the server-required type or options when the export is not NFSv4, such as nfs with vers=3 for an older server.
$ findmnt --types nfs4 -o TARGET,SOURCE,FSTYPE /mnt/projects TARGET SOURCE FSTYPE /mnt/projects files.example.net:/srv/nfs/projects nfs4
$ ls /mnt/projects README.txt reports
If the mount succeeds but file access fails, check export rules, filesystem ownership, UID/GID mapping, and any required Kerberos security option before making the entry persistent.
$ sudo umount /mnt/projects
$ systemd-escape --path --suffix=automount /mnt/projects mnt-projects.automount
The matching mount unit for this path is mnt-projects.mount.
$ sudoedit /etc/fstab
files.example.net:/srv/nfs/projects /mnt/projects nfs4 rw,_netdev,x-systemd.automount,x-systemd.idle-timeout=5min,x-systemd.mount-timeout=30s 0 0
_netdev marks the entry as a network mount. x-systemd.automount creates the on-demand trigger, x-systemd.idle-timeout=5min lets systemd unmount the export after inactivity, and x-systemd.mount-timeout=30s limits how long the first access waits for the server.
Add nofail only when the export is optional for this client. A critical application path should fail visibly if the server export cannot mount.
$ sudo findmnt --verify --tab-file /etc/fstab
[W] your fstab has been modified, but systemd still uses the old version;
use 'systemctl daemon-reload' to reload
0 parse errors, 0 errors, 1 warning
The warning is expected immediately after editing /etc/fstab. Fix parse errors before reloading the systemd manager.
$ sudo systemctl daemon-reload
$ sudo systemctl start mnt-projects.automount
The automount unit is the trigger. Starting it should not mount the NFS export until a process accesses /mnt/projects.
$ systemctl show -p ActiveState -p SubState mnt-projects.automount ActiveState=active SubState=waiting
$ ls /mnt/projects README.txt reports
The first access can pause while systemd starts mnt-projects.mount and the client contacts the NFS server.
$ systemctl show -p ActiveState -p SubState mnt-projects.mount ActiveState=active SubState=mounted
$ findmnt --types nfs4 -o TARGET,SOURCE,FSTYPE /mnt/projects TARGET SOURCE FSTYPE /mnt/projects files.example.net:/srv/nfs/projects nfs4
If the path does not mount, inspect both generated units with sudo journalctl -u mnt-projects.automount -u mnt-projects.mount -b and confirm the manual mount still works.