Introduction
NFS is a net file system access protocol. It provides remote access to file system objects, and allows working with them as if they were local.
Next, we'll look on mount process of distributed file system resource on CentOS.
Any actions must be performed with elevated rights.
At the beginning, we deploy additional software on the client where we plan connect the remote directory.
To do this, open the terminal and insert command there:
This will install packages for NFS protocol support and management tools.
Finding an NFS share
After that we must to decide which the NFS directory we wish to connect. Do this by insert the command on the client server:
This will list all available shared directories.
Create a mount point
Now we create the so-called mount point. It represents the folder where the distributed file system resource will be mounted. It can be created anywhere on the file system, but is usually located in the /mnt directory. It is created with the following command:
Mounting an NFS share
Everything is ready to mount the NFS share. We execute the command:
For example, for the server IP - 10.10.1.1, NFS share - /home/nshare, the command will look like this:
Installation check
To verify that the resource was successfully mounted, you can run:
The output of the command will list all mounted file systems.
It should show the NFS share mounted to the /mnt/nshare directory. To be able to automatically mount the NFS resource at each startup, you can edit the /etc/fstab file with any convenient text editor by adding the following line there:
After editing, you must save the file and exit the text editor. Now the NFS share will be automatically mounted every time the server is started.
Conclusion
The article looked at how to mount an NFS share in CentOS 8. Following it, you can easily access files and directories located on remote servers and work with them as if they were local.
You may be also interested in
- Useful guide how to test internet connection speed in CentOS 8
- More instructions for CentOS
- Get started with our VPS with preinstalled CentOS
FAQ: Mounting NFS Shares on CentOS
- Q: What is NFS used for?
A: NFS (Network File System) is a protocol that allows you to access and manage files on a remote server as if they were stored locally on your CentOS system. - Q: Do I need special permissions to mount an NFS share?
A: Yes, you need root or sudo privileges to install required packages, create mount points, and mount NFS directories. - Q: How do I check available NFS shares on a server?
A: Use the command showmount -e <server-ip> to list all exported directories from the NFS server. - Q: Can I mount NFS shares automatically at system startup?
A: Yes, you can configure automatic mounting by adding the NFS share details into the /etc/fstab file. - Q: What package is required to enable NFS on CentOS?
A: You need to install the nfs-utils package using sudo dnf install nfs-utils.