Saturday, 30 November 2019

How to Mount an NFS Share on CentOS 7 Client



NFS (Network File System) is a distributed network file sharing system protocol. It is provides to share files and folders between Linux distributions over the network. Nfs-utils package needed to mount NFS share on clients as local file system.
This article describes How to Mount an NFS Share on CentOS 7 Client.

Step 1. Package Installation: nfs-utils package needed to mount NFS share on clients as local file system. Run the following command to install nfs-utils:

[root@lc-nfsclient ~]# yum install nfs-utils
Loaded plugins: fastestmirror
………………..
Installed:
  nfs-utils.x86_64 1:1.3.0-0.65.el7

Dependency Installed:
  gssproxy.x86_64 0:0.7.0-26.el7          keyutils.x86_64 0:1.5.8-3.el7
………………..
  quota-nls.noarch 1:4.01-19.el7          rpcbind.x86_64 0:0.2.0-48.el7            tcp_wrappers.x86_64 0:7.6-77.el7

Complete!
[root@lc-nfsclient ~]#

Step 2. Mounting NFS Share: Run the following command to check available NFS Shared directory on the Server:

[root@lc-nfsclient ~]# showmount -e 192.168.43.23
Export list for 192.168.43.23:
/nfsshare 192.168.43.24
[root@lc-nfsclient ~]#

Run the following commands to create a new directory and mount NFS Shared directory:

[root@lc-nfsclient ~]# mkdir /mnt/nfsdirectory
[root@lc-nfsclient ~]# mount 192.168.43.23:/nfsshare /mnt/nfsdirectory/
[root@lc-nfsclient ~]#

Step 3. Validate NFS Share Mount: Validate the NFS Server and client configuration by checking mount points:

[root@lc-nfsclient ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
………………….
192.168.43.23:/nfsshare   22G  5.6G   17G  26% /mnt/nfsdirectory
[root@lc-nfsclient ~]#

Step 4. Auto Mounting: Append the following entry to the /etc/fstab file to automatically mount the NFS Share on the local machine:

[root@lc-nfsclient ~]# vi /etc/fstab
………………
192.168.43.23:/nfsshare /mnt/nfsdirectory/  nfs      defaults    0       0
[root@lc-nfsclient ~]#

Save the file and run the following command to mount the NFS Share folder:

[root@lc-nfsclient ~]# mount -a

Done!!! NFS Share is successfully mounted on CentOS 7 Client.

NFS File Sharing Server Configuration: Follow the article How to Install and Configure NFS File Sharing Server on CentOS 7.

No comments:

Post a comment