Setup and Configure NFS Mounts on Linux Server ( RedHat & Centos)
Setup and Configure NFS Mounts on Linux Server ( RedHat & Centos)
Network File System (NFS) is a distributed file system protocol originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a network much like local storage is accessed. NFS, like many other protocols, builds on the Open Network Computing Remote Procedure Call (ONC RPC) system. The Network File System is an open standard defined in RFCs, allowing anyone to implement the protocol.
Follow below steps for NFS installation and configuration.
Need to install NFS packages on NFS server and client.
[root@localhost]# yum install nfs-utils nfs-utils-lib
[root@localhost]# /etc/init.d/nfs start
chkconfig utility is a command line tool that allows to start service in specific run level.
After NFS service installation, we have to export shared directory.
This shared directory should be added in /etc/exportfs file.
Here, for example I have one directory with name
/sunil
We need export the directory.
# vi /etc/exports
/sunil 172.16.60.144(rw,sync,no_root_squash,no_subtree_check)
Directory manipulation option.
ro :
The shared directory is read only.
rw :
The client machine will have read and write access to the directory
sync:
Sync files and folders after updates changes.
no_root_squash:
no_root_squash will give you the root permission to access create files on a NFS Server.
no_subtree_check:
It prevents sub tree checking. When a shared directory is the sub directory of a larger file system. NFS performs scan of every directory above it. in order to verify its permissions and details
After setup shared directory run following command to export them.
The exportfs command is used to maintain the current table of exported file systems for NFS.
#exportfs -a
Installing and configuring NFS client.
Install NFS service on client machine.
Use below commands
[root@localhost]# yum install nfs-utils nfs-utils-lib
[root@localhost]# /etc/init.d/nfs start
After Installation restart service.
[root@sunilkatkade]# /etc/init.d/nfs start
[root@sunilkatkade]# /etc/init.d/rpcbind start
After that create a directory with NFS shared files.
# mkdir -p /mnt/test
Then mount it on shared directory
# mount -t nfs 172.16.60.24:/sunil /mnt/test
To always active mount make entry in /etc/fstab file.
# vi /etc/fstab
172.16.60.24:/sunil /mnt/test nfs ew 0 0
Leave a comment