1. What Is NFS? Advantages and Basic Use Cases on Ubuntu
NFS (Network File System) is a protocol used to share files over a network. This article explains the basics of using NFS on Ubuntu, highlighting the benefits of adopting NFS in server management and how to configure it properly.
How NFS Works and Its Use Cases
NFS simplifies file sharing between servers and clients by functioning as a remote file system. It is suitable for synchronizing files across multiple Linux servers and is also effective for backup purposes in cloud environments.
Benefits of Using NFS on Ubuntu
- Efficient Data Synchronization: Multiple servers can access the same data, streamlining management.
- High Compatibility Across Linux: NFS is supported by many Linux distributions, including Ubuntu.
- Cloud Service Integration: Flexible data sharing is achievable even with cloud storage solutions.
2. Requirements and Installation of NFS
A proper system environment is required to operate NFS. Below are the system requirements and the installation steps.
Hardware and Software Requirements
- CPU and Memory: A dual-core CPU or higher and at least 2GB of memory are recommended.
- Network and Storage: A stable Ethernet connection and storage space for shared data are required.
Installing NFS Packages
Install the NFS server and client packages using the following commands:
sudo apt update
sudo apt install nfs-kernel-server nfs-commonUsing an LTS version of Ubuntu provides long-term support and ensures a stable operating environment.
3. Setting Up the NFS Server
Set up the NFS server on Ubuntu, create a shared directory, and configure its permissions.
Creating and Configuring Shared Directories
- Create the directory and set permissions: Use the following commands to create the shared directory
/nfsand allow access from all clients.
sudo mkdir /nfs
sudo chmod 777 /nfs- Edit the /etc/exports file: Add the following entry to configure access permissions.
/nfs *(rw,sync,no_subtree_check)This configuration grants read/write access to all clients.
Firewall Configuration
If the firewall is enabled, open port 2049 for NFS communication.
sudo ufw allow from <client IP address> to any port nfs4. Configuring the NFS Client
Client configuration includes installing the required packages and setting up the NFS mount to connect to the server.
Installing Client Packages and Mounting NFS
- Install the NFS client package: Install
nfs-commonon the client.
sudo apt install nfs-common- Mount the NFS directory: Use the following command for manual mounting, or add an entry to
/etc/fstabfor automatic mounting.
sudo mount <server IP address>:/nfs /mntAutomatic mount configuration:
<server IP address>:/nfs /mnt nfs defaults 0 0To verify the mount status, run the df -h command.

5. Operations and Troubleshooting
This section introduces useful commands for managing NFS and resolving common issues encountered during operation.
Automatic Mount Configuration
Ensure mounts persist after reboot by enabling automatic startup for netfs using chkconfig.
sudo chkconfig netfs onCommon Issues and Solutions
- Access Denied Errors: If “Permission denied” occurs, verify directory permissions and the
/etc/exportsconfiguration. - NFS Version Mismatch: To avoid issues caused by version differences, specify the version using options such as
nfsvers=3.
6. Advanced Uses of NFS
Load Balancing on Web Servers
NFS is effective when multiple web servers access the same files. It enables efficient data sharing and helps distribute server load.
Using NFS in Cloud Environments
Cloud providers such as AWS and GCP offer NFS-based file sharing services, allowing efficient data management even in cloud infrastructure.
7. Conclusion
This article explained how to set up NFS on Ubuntu and introduced essential management and troubleshooting techniques for daily operation. By utilizing NFS, you can improve data-sharing efficiency, enhance system flexibility, and support cloud-based workloads and high-traffic web servers.


