How Network File System works :- NFS provides data access as shared file system over the network and interact that file systems as local directory as it’s mounted locally on our system on network. NFS was developed for the purpose of sharing of files and folders in between Linux/Unix systems by Sun Microsystems in 1980.

NFS Provides Linux/UNIX server to share folder with different LINUX/UNIX clients machines over the network. ‘NFS server‘ exports as from /etc/export as a directory then NFS client mounts this shared directory on client/user’s machine. Linux Cent OS and RHEL 7 supports NFS version like NFSv3 and NFSv4.

How NFS Service Works:-

There are mainly 03 versions of NFS, NFS version 2 (NFSv2) is older and widely supported.

NFS version 3 (NFSv3) supports safe asynchronous writes and is more robust at error handling than NFSv2. it also supports 64-bit file sizes and offsets, allowing clients to access more than 2Gb of file data, NFSv2 does not supported on Red Hat Enterprise Linux7 version.

NFS version 4 (NFSv4) works through firewalls and on the Internet, no longer requires an rpcbind service, supports ACLs, and utilizes stateful operations.

Red Hat Enterprise Linux 6 supports NFSv2, NFSv3, and NFSv4 clients. When mounting a file system via NFS, Red Hat Enterprise Linux uses NFSv4 by default, if the server supports it

NFS uses Transmission Control Protocol (TCP) running over an IP network, NFSv2 and NFSv3 can use the User Datagram Protocol (UDP) running over an IP network to provide a stateless network connection between the client and server. When using NFSv2 or NFSv3 with UDP, the stateless UDP connection has less protocol overhead than TCP.

This can translate into better performance on very clean, non-congested networks. However, because UDP is stateless, if the server goes down unexpectedly, UDP clients continue to saturate the network with requests for the server. In addition, when a frame is lost with UDP, the entire RPC request must be retransmitted; with TCP, only the lost frame needs to be resent. For these reasons, TCP is the preferred protocol when connecting to an NFS server.

How to can we setup NFS Linux CentOS/ RHEL/Debian/Ubuntu Linux step by step

To setup nfs server configuration in linux step by step we have to first install the required package called nfs-utils

#yum install nfs-utils nfs-utils-lib

To run several startup scripts for the NFS server automatically on boot

#chkconfig nfs on service rpcbind start service nfs start

Now we have to export the Shared Directory

Here we have to decide which data directory we want to share with the client server. The chosen directory will be be added to the “/etc/exports”.

If you wanted to share the directory, /data then we have to add following line under “/etc/export”.


Details of specified configuration as:-

  • rw: This option allows the client server to both read and write within the shared directory
  • sync: Sync confirms requests to the shared directory only once the changes have been committed.
  • no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory on it, to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
  • no_root_squash: This phrase allows root to connect to the designated directory

after the above configuration run the following command to export them:

exportfs -a

NFS Client Side Installation/Configuration:-

yum install nfs-utils nfs-utils-lib

Now on the client side we need to mount that shared directory to access it locally so, first we have to find out that shares available on the remote server or NFS Server.

[root@techitadmin~]#showmount -e

Export list for

mkdir /data

mkdir -p /data
mount -t nfs /data

check and verify using this command : –

mount | grep nfs

df -h