A Debian server waiting for an unavailable NFS export can start with an empty directory, a failed mount, or unnecessary delays. For a share used intermittently, like a project archive or repository, Autofs mounts the path on first access and releases it after a period of inactivity.
The following procedure targets a Debian or Ubuntu server with an NFS export already available. It starts with a manual mount, then configures an indirect point /srv/nfs/projets. Keep /etc/fstab for a volume that a service needs right at startup.

Test the NFS export before modifying Autofs
Autofs hides the mount operation behind access to a directory. It does not fix a missing NFS export, a broken DNS, or permissions denied by the server. First, install the NFS client on Debian or Ubuntu, then test the path with mount in a temporary directory.
sudo apt update
sudo apt install nfs-common
sudo mkdir -p /mnt/nfs-manual-test
sudo mount -t nfs4 nfs.example.lan:/srv/nfs/projets /mnt/nfs-manual-test
findmnt -T /mnt/nfs-manual-test
ls -la /mnt/nfs-manual-test
sudo umount /mnt/nfs-manual-test
sudo rmdir /mnt/nfs-manual-test
Replace the server and path with the export provided by your team. findmnt should display an NFS source and the directory should be readable with the expected permissions. If this test fails, stop here. Configuring Autofs before having a functioning NFS mount complicates troubleshooting.
showmount -e nfs.example.lan can help on servers that still publish the MOUNT protocol. Do not use it as a mandatory test: an NFSv4 server may expose nothing through this command while still accepting the documented mount.
Declare an indirect mount point
On Debian and Ubuntu, install autofs after the NFS test. The file /etc/auto.master associates a root directory with a map. The map then contains the subdirectories that trigger the mounts. The format of an indirect map is detailed in the autofs manual.
sudo apt install autofs
sudoedit /etc/auto.master
Add this line in /etc/auto.master:
/srv/nfs /etc/auto.nfs --timeout=120
/srv/nfs is the Autofs point. The folder projets will be created under this root on first access. The timeout --timeout=120 requests unmounting after two minutes of inactivity. Do not put 0 here: automatic unmounting would be disabled.
Then create the referenced map and keep it in text format. A program type map can execute a program to generate an entry. This mechanism is appropriate for managed administration, not in this starting configuration.
sudo install -m 644 /dev/null /etc/auto.nfs
sudoedit /etc/auto.nfs
Add one entry per share:
projets -fstype=nfs4,rw nfs.example.lan:/srv/nfs/projets
The word projets forms the local path /srv/nfs/projets. The part after the options is the NFS export validated above. Avoid double slashes in map paths. The manual auto.master indicates that these paths can cause failures that are difficult to expire.
I would reserve this indirect mount for directories opened occasionally. For a volume that contains a database, a container, or files essential to a systemd service, I would keep an explicit mount with its network dependencies. Autofs creates the mount at the moment the path is accessed, so the first access may wait for the network or fail.
Restart Autofs and trigger the mount
Restart the service to account for the master map, then display the maps read by the daemon. automount -m shows their configuration. This command does not necessarily contact the NFS export and does not yet prove that the mount works. The manual automount describes this display mode.
On a server already using Autofs, perform this restart while no processes are using the relevant paths.
sudo systemctl restart autofs
sudo automount -m
systemctl --no-pager --full status autofs
sudo journalctl -u autofs -n 50 --no-pager
The service should be active. A syntax error, a missing map file, or an inaccessible path appears in the log. Correct this before testing the share.
The next access triggers the mount:
ls -la /srv/nfs/projets
findmnt -T /srv/nfs/projets
mountpoint /srv/nfs/projets
After ls, findmnt should show the NFS server and mountpoint should return a success status. Wait more than two minutes without opening the directory, then re-run findmnt -T /srv/nfs/projets. Depending on the system, the Autofs map remains visible under /srv/nfs, while the NFS mount of projets disappears until the next access.
Keep Autofs out of critical paths
Autofs is suitable for a projects directory, an archive, or a share accessed by an administrator. A service starting before the network, a process that tolerates no delay, or a path used to write business data requires a permanent mount and explicit systemd dependencies.
The guide NFS under Linux covers the maintained network mount over time. Here, the goal is different: to prevent a rarely used share from weighing on startup, while keeping a command and a log to prove why the mount appears or disappears.