Linux clients often need the same NFS share available at a stable local path after reboot, service start, or the first time a user opens a project directory. An /etc/fstab entry records that remote export as part of the client's filesystem layout so operators do not have to repeat a manual mount command.

An NFS fstab record contains the server export, local mount point, filesystem type, mount options, and the two unused dump and fsck fields. Current Linux NFS client documentation uses nfs in the fstype field and selects a protocol version with an option such as vers=4.2 when the server requires one.

Use a manual mount test before saving the record in /etc/fstab. On a systemd-based client, the entry can create an on-demand automount, avoid early boot delays, and put a timeout around the actual NFS mount attempt when the path is first accessed.

Steps to mount an NFS export with /etc/fstab:

  1. Open a terminal on the Linux client with sudo privileges.
  2. Install the NFS client package if mount.nfs is not already available.
    $ sudo apt install nfs-common

    Use sudo dnf install nfs-utils on RHEL, CentOS Stream, Fedora, and compatible systems.

  3. Create the local mount point.
    $ sudo mkdir --parents /mnt/projects

    Files already inside /mnt/projects become hidden while the NFS filesystem is mounted there.

  4. Mount the export manually with the options planned for /etc/fstab.
    $ sudo mount -t nfs -o rw,hard,vers=4.2,proto=tcp files.example.net:/srv/nfs/projects /mnt/projects

    Replace files.example.net:/srv/nfs/projects with the server and export path assigned by the NFS server owner. Add server-required options such as sec=krb5p before saving the fstab line.

  5. Verify that the manual mount uses the expected server export.
    $ findmnt -o TARGET,SOURCE,FSTYPE /mnt/projects
    TARGET        SOURCE                               FSTYPE
    /mnt/projects files.example.net:/srv/nfs/projects nfs4

    The fstab entry can use nfs while a mounted NFSv4 export appears as nfs4 in the live mount table.

  6. List the mounted directory as a user who should have access.
    $ ls /mnt/projects
    README.txt  reports

    If the mount succeeds but files cannot be read or written, check the server export rule, filesystem permissions, UID/GID mapping, and any security option required by the export.

  7. Unmount the manual test mount.
    $ sudo umount /mnt/projects
  8. Open /etc/fstab in a text editor.
    $ sudoedit /etc/fstab
  9. Add the NFS export entry.
    files.example.net:/srv/nfs/projects /mnt/projects nfs rw,hard,vers=4.2,proto=tcp,_netdev,x-systemd.automount,x-systemd.mount-timeout=30s,x-systemd.idle-timeout=10min 0 0

    _netdev tells systemd to treat the entry as a network mount. x-systemd.automount creates an on-demand trigger, x-systemd.mount-timeout=30s limits the mount attempt, and x-systemd.idle-timeout=10min lets systemd release the idle mount later.

    A wrong server name, export path, mount point, or option in /etc/fstab can delay boot or fail the first path access. Keep the manual mount test successful before relying on the saved entry.

  10. Verify that /etc/fstab parses without errors.
    $ sudo findmnt --verify
    Success, no errors or warnings detected
  11. Review the saved fstab record for the mount point.
    $ findmnt --fstab --target /mnt/projects -o TARGET,SOURCE,FSTYPE,OPTIONS
    TARGET        SOURCE                              FSTYPE OPTIONS
    /mnt/projects files.example.net:/srv/nfs/projects nfs    rw,hard,vers=4.2,proto=tcp,_netdev,x-systemd.automount,x-systemd.mount-timeout=30s,x-systemd.idle-timeout=10min
  12. Reload the systemd manager configuration after changing /etc/fstab.
    $ sudo systemctl daemon-reload
  13. Print the generated automount unit name for the mount point.
    $ systemd-escape --path --suffix=automount /mnt/projects
    mnt-projects.automount
  14. Start the generated automount unit.
    $ sudo systemctl start mnt-projects.automount

    On the next boot, systemd creates the same automount unit from /etc/fstab.

  15. Check that the automount trigger is active.
    $ systemctl is-active mnt-projects.automount
    active
  16. Access the mount point to trigger the NFS mount.
    $ ls /mnt/projects
    README.txt  reports

    The first access can pause while the client contacts the NFS server and completes the mount.

  17. Verify that the mounted path uses the expected NFS export.
    $ findmnt -o TARGET,SOURCE,FSTYPE /mnt/projects
    TARGET        SOURCE                               FSTYPE
    /mnt/projects files.example.net:/srv/nfs/projects nfs4