How to Mount an NFS Share in Linux

Network File System (NFS) is a distributed file system protocol that enables sharing remote directories over a network. It allows you to mount remote directories on your system and interact with remote files as if they were local.
On Linux and Unix-like systems, the mount command attaches a shared NFS directory to a local mount point in your directory tree.
In this tutorial, we will show you how to mount an NFS share manually or automatically on Linux systems.
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.
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. Ensures the system waits for the network before mounting.
A typical fstab entry for a reliable NFS mount:
10.10.0.10:/backups /var/backups nfs defaults,nofail,_netdev 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, as it may corrupt the file system.
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 NFS service is not running on the remote server. Restart it with:
sudo systemctl restart nfs-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
. Ensure firewall rules allow traffic on ports 111 and 2049. 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 _netdev to the fstab options. nofail prevents a boot failure if the share cannot be reached, and _netdev ensures the mount waits for the network to be ready.
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 and _netdev. 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 list the directories the server is exporting and which clients are allowed to access them.
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 the nofail and _netdev options to ensure reliable boot behavior. 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