Network File System, or NFS, is a distributed file system protocol that allows you to share directories and files with other Linux clients in your network. This protocol was developed by Sun Microsystems, and is widely used for sharing files between Linux/Unix systems. In this blog post, we will learn how to mount an NFS share on Linux.
Installing NFS
Before we can mount an NFS share, we must ensure that NFS utilities are installed on our system. If you are on a Debian-based system like Ubuntu, you can install the necessary utilities by running the following command:
sudo apt-get install nfs-common
If you’re on a Red Hat-based system like CentOS, you can use the following command:
sudo yum install nfs-utils
Creating the Mount Point
Once the NFS utilities are installed, the next step is to create the directory where we’ll mount the NFS share. This can be any location on your system, but for the purpose of this tutorial, we will use /mnt/nfs. We can create this directory with the following command:
sudo mkdir -p /mnt/nfs
Mounting the NFS Share
Now we are ready to mount the NFS share. Let’s say the NFS server is at IP address 192.168.1.10 and the share is at /home/nfs. We can mount this share to our previously created directory with the following command:
sudo mount 192.168.1.10:/home/nfs /mnt/nfs
Verifying the Mount
After running the mount command, we can verify if the NFS share has been mounted successfully by running the df -h command. You should see an entry for the NFS share in the output:
df -h
Conclusion
That’s it! You have successfully mounted an NFS share on your Linux system. Remember, if you reboot your system, the NFS share will need to be remounted. To avoid this, you can add an entry in your /etc/fstab file to mount the NFS share at boot time. Stay tuned for more Linux tips and tricks!