Mounting NFS Share on Linux
This guide demonstrates how to connect a Linux server to a remote NFS storage, allowing files stored on the NFS server to be accessed as if they were on the local disk.
The process involves three main steps:
- Install the NFS client
- Mount the share
- Verify if the mount was done correctly
📄 Prerequisites
Before starting, make sure that:
- The server is running a compatible Linux distribution (Ubuntu, Debian, CentOS, Rocky, AlmaLinux, etc.)
- The server has connectivity to the NFS server
- The NFS share is already configured on the server
- The user has sudo permissions
🚀 Step 1 – Install the NFS client
First, install the package responsible for NFS protocol support on the operating system.
Debian / Ubuntu
sudo apt install nfs-common -y
RHEL / CentOS / AlmaLinux / Rocky
sudo dnf install nfs-utils -y
Older systems (CentOS 7)
sudo yum install nfs-utils -y
The package responsible for the NFS client may vary depending on the Linux distribution:
- nfs-common → Debian / Ubuntu
- nfs-utils → RHEL / CentOS / AlmaLinux / Rocky
These packages provide the necessary tools to access NFS shares.
➕ Step 2 – Mount the NFS share
After installing the NFS client, mount the shared directory from the server.
sudo mount IP_DO_SERVIDOR:/mnt/nfs_shared /mnt
Command structure
mount [servidor]:[diretório_exportado] [diretório_local]
Practical example
sudo mount 172.16.40.131:/mnt/storage /storage
After running the command, the contents of the remote directory will be accessible in the defined local directory.
The NFS share can be accessed using a private IP (recommended for internal networks, greater security, and lower latency) or public IP, provided the service is properly exposed and the necessary ports are open (especially 2049/TCP).
❌ Step 3 – Verify if the share was mounted
To confirm that the NFS share was mounted correctly, use:
df -h
If the mount was successful, the NFS storage will appear listed among the mounted file systems.
🔧 Make the mount permanent
The mount performed with the command mount is temporary.
After restarting the server, the share will be automatically unmounted.
To make the mount permanent, add the configuration to the file:
sudo nano /etc/fstab
Add the following line:
172.16.40.131:/mnt/storage /mnt nfs defaults,_netdev 0 0
The _netdev parameter ensures that the system waits for the network to start before mounting the NFS during boot.
✅ Conclusion
After configuration, the Linux server will access the remote NFS storage as if it were a local directory, allowing file sharing between multiple servers.
This model is widely used in environments such as:
- application clusters
- containers
- DevOps environments
🧠 Questions?
Contact technical support and send your question—we are available to help you!