How to Mount an NFS Share in Linux

When a file server or NAS on your network exports a directory over NFS, you can reach those files from another Linux machine as if they lived on a local disk. This is a common setup for shared backups, home directories, and project storage.
Network File System (NFS) is the distributed file system protocol that makes this possible. On Linux and Unix-like systems, the mount command attaches the remote NFS export to a local mount point in your directory tree. From there, you can access the remote files according to the permissions set on the server.
This guide explains how to mount an NFS share on Linux, both manually for a one-time mount and automatically through /etc/fstab so the share returns after a reboot.
Quick Reference
| Task | Command |
|---|---|
| Install NFS client (Ubuntu, Debian) | sudo apt install nfs-common |
| Install NFS client (Fedora, RHEL) | sudo dnf install nfs-utils |
| List exports on NFS server | showmount -e SERVER_IP |
| Mount NFS share | sudo mount -t nfs SERVER:/export /mountpoint |
| Mount with options | sudo mount -t nfs -o rw,sync SERVER:/export /mnt |
| Verify mount | mount | grep nfs |
| Unmount NFS share | sudo umount /mountpoint |
| Force unmount | sudo umount -f /mountpoint |
| Lazy unmount | sudo umount -l /mountpoint |
| Mount all fstab entries | sudo mount -a |
Installing NFS Client Packages
To mount an NFS share, you will first need to install the NFS client package. The package name varies between Linux distributions.
On Ubuntu, Debian, and Derivatives:
Terminalsudo apt update sudo apt install nfs-commonOn Fedora, RHEL, and Derivatives:
Terminalsudo dnf install nfs-utils
Listing Available NFS Exports
Before mounting, you can check which directories the NFS server is exporting with the showmount command:
showmount -e 10.10.0.10Export list for 10.10.0.10:
/backups 10.10.0.0/24
/data *This shows the exported paths and the clients that are allowed to mount them. If showmount is not available, install it alongside the NFS client utilities.
The command queries the server’s mount service, which an NFSv4-only server may not provide. If showmount -e returns no exports, confirm the export path on the server or try mounting the known NFSv4 path directly.
Manually Mounting an NFS Share
Mounting a remote NFS share is the same as mounting any regular file system.
To mount an NFS file system on a given mount point, use the mount
command in the following form:
mount [OPTION...] NFS_SERVER:EXPORTED_DIRECTORY MOUNT_POINTHere, NFS_SERVER:EXPORTED_DIRECTORY is the remote NFS export, and MOUNT_POINT is the local directory where you want to access it.
Follow these steps:
Create a local directory to serve as the mount point:
Terminalsudo mkdir /var/backupsA mount point is a directory on the local machine where an NFS share is to be mounted.
Mount the NFS share as root or a user with sudo privileges:
Terminalsudo mount -t nfs 10.10.0.10:/backups /var/backupsHere,
10.10.0.10is the NFS server’s IP address,/backupsis the exported directory, and/var/backupsis the local mount point.On success, the command produces no output.
Pass additional options with
-o(for example,-o rw,sync). Multiple options are provided as a comma-separated list. To get a full list of options, typeman mountin your terminal.To verify that the remote NFS volume is successfully mounted, use either the
mountordf -hcommand:Terminalmount | grep nfsTerminaldf -h
Once the share is mounted, the mount point becomes the root directory of the mounted filesystem.
When you manually mount the share, it does not persist after a reboot.
Automatically Mounting NFS Shares with /etc/fstab
For persistent mounts, configure automatic mounting on boot using the /etc/fstab file. This file contains a list of entries that define which filesystems are mounted on boot.
The line must include the hostname or the IP address of the NFS server, the exported directory, and the mount point on the local machine.
Steps to automatically mount an NFS share:
Create a mount point if it does not already exist:
Terminalsudo mkdir /var/backupsEdit the
/etc/fstabfile with your text editor :Terminalsudo nano /etc/fstabAdd this line:
/etc/fstabini# <file system> <dir> <type> <options> <dump> <pass> 10.10.0.10:/backups /var/backups nfs defaults,nofail 0 0Where
10.10.0.10is the NFS server IP address,/backupsis the exported directory, and/var/backupsis the local mount point. Thenofailoption prevents the system from halting at boot if the NFS server is unreachable.Mount the share immediately without rebooting:
Terminalsudo mount /var/backupsAlternatively, mount all entries defined in
/etc/fstabat once:Terminalsudo mount -aThe
mountcommand reads the contents of/etc/fstaband mounts the share.
Next time you reboot the system, the NFS share will be mounted automatically.
NFS Mount Options
Common options you can pass with -o or add to the /etc/fstab entry:
rw/ro— Mount read-write (default) or read-only.sync/async— Write operations wait for acknowledgment from the server (sync) or are buffered locally (async).syncis safer;asyncis faster.noexec— Prevent execution of binaries on the mounted filesystem.nofail— Do not report an error if the device does not exist at boot. Useful for NFS shares that may not be available immediately.vers=4/vers=3— Force a specific NFS protocol version. NFSv4 is the default on modern systems._netdev— Mark the filesystem as requiring network access. Systemd already recognizes NFS as a network filesystem, so this option is mainly useful for network-backed filesystems it cannot identify automatically.x-systemd.automount— Create an automount unit and mount the share when you first access the path. This avoids delaying boot while an unavailable server times out.
A typical fstab entry for a reliable NFS mount:
10.10.0.10:/backups /var/backups nfs defaults,nofail,x-systemd.automount 0 0Unmounting NFS Shares
To detach a mounted NFS share, use the umount command followed by either the local mount point or the remote share:
sudo umount /var/backupsIf the share is defined in the fstab file, remove the entry to prevent remounting on boot.
The umount command will fail if the mounted volume is in use. To find out which processes are accessing the NFS share, use the fuser command:
fuser -m /var/backupsStop them with the kill
command, then retry.
If you still have problems unmounting the share, use the -l (--lazy) option, which allows you to unmount a busy file system as soon as it becomes available:
sudo umount -l /var/backupsIf the remote server is unreachable, use the -f (--force) option to force an unmount:
sudo umount -f /var/backupsAvoid the force option when possible. Unsaved writes may be lost, and the command can still hang when the server is unreachable.
Troubleshooting
“Permission denied”
The directory may not be correctly exported on the server. Check /etc/exports on the NFS server and run sudo exportfs -ar to reload exports. The client IP address must also be listed in the export entry.
“RPC: Program not registered”
The server is not advertising an RPC service required for the requested NFS version. From the client, list the services registered on the server:
rpcinfo -p 10.10.0.10If the expected NFS, mountd, or rpcbind service is missing, check the server logs. On Fedora, RHEL, and derivatives, restart the NFS service with:
sudo systemctl restart nfs-serverOn Ubuntu, Debian, and derivatives, run:
sudo systemctl restart nfs-kernel-server“Stale file handle”
This occurs after the server reboots or a file is deleted while mounted. Unmount and remount the share on the client to resolve it.
“Server not responding” or connection timeout
Check network connectivity using ping
and traceroute
. NFSv4 normally uses TCP port 2049. NFSv3 also relies on rpcbind, mountd, and other RPC services that may use additional ports, so configure fixed service ports on the server before adding firewall rules. If the NFS version is mismatched, specify vers=3 or vers=4 explicitly in the mount options.
System halts at boot when NFS server is unavailable
Add nofail and x-systemd.automount to the fstab options. nofail lets boot continue if the share cannot be mounted, while x-systemd.automount delays the connection until you access the mount point.
FAQ
What is the difference between NFS v3 and NFS v4?
NFSv4 is the modern standard and includes built-in security (Kerberos support), stateful operations, and better firewall compatibility (single port 2049). NFSv3 uses multiple ports and requires portmapper (port 111). Most modern Linux distributions default to NFSv4. Use vers=3 in mount options only if the server does not support v4.
How do I automatically mount an NFS share at boot?
Add an entry to /etc/fstab with the NFS server path, local mount point, type nfs, and options including nofail. Add x-systemd.automount when you want the connection to start on first access instead of during boot. Run sudo mount -a to test the entry before rebooting.
Why does the NFS mount not persist after a reboot?
Manual mounts with mount -t nfs are not persistent. To keep a mount across reboots, add the entry to /etc/fstab as described in the Automatically Mounting
section.
How do I check which NFS shares are available on a server?
Use showmount -e SERVER_IP to query the server’s export list. An NFSv4-only server may not expose the mount service used by showmount, so an empty result does not always mean that no exports exist.
What does the nofail option do in fstab?nofail tells the system not to report an error and not to halt the boot process if the filesystem cannot be mounted. This is especially useful for network filesystems like NFS that may not be available immediately at boot time.
Conclusion
Mounting an NFS share on Linux requires installing the client utilities, creating a local mount point, and running mount -t nfs. For persistent mounts, add the entry to /etc/fstab with nofail, and use x-systemd.automount when the server may not be available during boot. To learn more about general filesystem mounting, see the mount command guide
.
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page