What is NFS – Network File Sharing

– It stands for Network File System, it is a utility provided in the Linux environment using which you can share files and folders to any specific client or a network.

– NFS works in a Client-Server model, where server shares the file system/folder which the client access as and when required.

Configuring NFS

Server side


– Create a folder
           # mkdir /share
– Edit the config file
           # vi /etc/exports
           —————————————————-
           /share 192.168.80.20/255.255.255.0(rw,sync)
           /share 192.168.80.0(rw,sync)
           /share station1.test.com(rw,sync)
           /share *(rw,sync)
           /share *.test.com(rw,sync)
           —————————————————-

– Change the folder permission
           # chmod 777 /share

– Check the services
           # chkconfig portmap on
           # service portmap restart
           # chkconfig nfs on
           # service nfs restart

Client Side


– To see what all folder/directories are shared by the server, to check it from the client side
           # showmount -e 192.168.80.20                  
– To mount the NFS share
           # mount  192.168.80.20:/santosh  /mnt
– Go to the folder on which the NFS share is mounted
           # cd /mnt

– Try to create a file inside the NFS share, to check if it is working or not (is it allowing us to write or not)
           # touch file.txt