NFS Server and Client on CentOS


NFS Server IP:
NFS Client Node1:
NFS Client Node2:
NFS Client Node3:
NFS Client Node4:

On the NFS Server & All Client machine as well:

yum install nfs-utils nfs-utils-lib

Edit the exports file that shows what to share and with whom. So run:nano /etc/exports

In my scenerio it was-


Apply the changes-

exportfs -a or /usr/sbin/exportfs -a

With a Restart of NFS Kernel Service-

/etc/init.d/nfs-kernel-server restart

The showmount command will tell you that all went well–for example,

root@share:~# showmount -e
 Export list for share:

On the Client Nodes:

We’re going to have to mount the remote shares, so let’s create some mount points. We’ll use the traditional /mnt as a starting point and create a directory called nfs under it to keep our shares consolidated.

The actual directories will correspond with their location on the host server. We can create each directory, and the necessary parent directories, by typing this:

mkdir -p /www

Now that we have some place to put our remote shares, we can mount them by addressing our host server, which in this guide is, like this:

mount /www

These should mount the shares from our host computer onto our client machine. We can double check this by looking at the available disk space on our client server:

root@psc1:~# df -h
 Filesystem Size Used Avail Use% Mounted on
 /dev/sda1 323M 145M 162M 48% /
 tmpfs 1007M 0 1007M 0% /lib/init/rw
 udev 1002M 128K 1002M 1% /dev
 tmpfs 1007M 0 1007M 0% /dev/shm
 /dev/sda9 2.8G 69M 2.6G 3% /home
 /dev/sda8 234M 6.1M 216M 3% /tmp
 /dev/sda5 2.8G 520M 2.1G 20% /usr
 /dev/sda6 1.4G 173M 1.2G 14% /var 323M 145M 162M 48% /www

As you can see at the bottom, only one of our shares has shown up. This is because both of the shares that we exported are on the same filesystem on the remote server, meaning that they share the same pool of storage. In order for the Avail and Use% columns to remain accurate, only one share may be added into the calculations.

If you want to see all of the NFS shares that you have mounted, you can type:

mount -t nfs
root@psc1:~# mount -t nfs on /www type nfs (rw,addr=

Now it’s time to add fstab entry so that the mount becomes permanent even after rebooting-

nano /etc/fstab /www nfs auto 0 0




Leave a Reply