• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

NFS Configuration

NFS Configuration
1. NFS Installation (Both Nodes)
2. Server Side Configuration (Host)
3. Configuring NFS on the Client (Guest)
4. Deleting, Moving Or Modifying A Share


NFS Configuration:

NFS stands for the Network File System. I t is used to share/map disk one Linux System to other Linux System. NFS was developed to allow the user to access remote directory as a mapped directory.
NFS is not a single program. I t is a suite of related programs which work together.
Portmap is the primary daemon. All other daemon rely on it. I t manages connections for applications that use the RPC (Remote Procedure Calls) specification, and it listens on port 111. The portmap daemon needs to be run on both the NFS server and client.
NFS starts the RPC processes to serve shared NFS file systems. The NFS daemon needs to be run on the NFS server only.
Nfslock allows NFS client(s) to lock files on the server via RPC processes. The nfslock daemon needs to be run on both the NFS server and client.
Netfs allows RPC processes to run on NFS client(s) to mount server directory. The nfslock daemon needs to be run on the NFS client only.




1. NFS Installation (Both Nodes)
1.1. Login as root on Redhat Linux Server.
1.2. First we need to check the NFS packages installation.
1.3. NFS is installed by default in Redhat Linux. To check whether the NFS installed or not we will use the RPM command with the grep command to search NFS packages.
# rpm -qa | grep nfs

1.4. I f NFS and portmap are not installed then we use the following command to install them. Filenames usually start with the name of software and a version number as shown below,
# rpm -Uvh nfs-utils-1.1.3-1.i386.rpm
Note: Perform the above mentioned steps on both Server and Client machines.




2. Server Side Configuration (Host)

2.1. The first step is to login as root user.
2.2. Create a directory,
# mkdir data
# cd data
# mkdir files
2.3. Now open the /etc/exports file in vi editor and update the entries as per requirement. Here in this tutorial we will give access to all IP’s by placing a * . The /etc/exports allows the clients and authenticates the user coming from the remote client(s),
# vi /etc/exports

/data/ files * (rw,sync)

Note(s) :
—> Here * means access to all IP’s while we can restrict by providing IP address like, [ /data/ files IP Address(rw,sync)] .
—> You can force your system to re-read the /etc/exports file after changing exports file by using following commands.
$ exportfs –a (I f directories are not yet exported to NFS.)
$ exportfs –r (To export only the new entries.)
2.4. We will use chkconfig to configure NFS to auto start on system startup. The chkconfig command configures required daemons to start at boot time.
# chkconfig –level 35 nfs on
# chkconfig –level 35 nfslock on

# chkconfig –level 35 portmap on

2.5. Start the NFS services and other related demons,

# service portmap startStarting portmap: [ OK ]

# service nfs start

Starting NFS services: [ OK ]

Starting NFS quotas: [ OK ]

Starting NFS daemon: [ OK ]

Starting NFS mountd: [ OK ]

# service nfslock start

Starting NFS statd: [ OK ]

Note: To check the current status of service use status instead of start.
2.6. Check the NFS status if it is running correctly or not with the rpcinfo command,
# rpcinfo -p localhost




 3. Configuring NFS on the Client (Guest)

 3.1. Login as the root user.
3.2. To auto start NFS use chkconfig command as we used above.
# chkconfig –level 35 netfs on
# chkconfig –level 35 nfslock on
# chkconfig –level 35 portmap on
3.3. To start the services of NFS and other related daemons.

# service portmap startStarting portmap: [ OK ]

# service netfs start

Mounting other filesystems: [ OK ]

# service nfslock start

Starting NFS statd: [ OK ]

3.4. Test NFS status with rpcinfo command.
# rpcinfo -p


3.5. Mount Points (Creation & Activation)
3.5.1. Auto & Permanent Create a mount point directory to mount with the remote NFS directory
and activate it through these commands. $ mkdir /mnt/nfs To make NFS mounted directories permanent we will add entries in the
/etc/ fstab file in addition to the creation of the mount point directory. The
/etc/ fstab file lists all the partitions that need to be auto-mounted when
the system boots.

# vi /etc/ fstab# Directory Mount Point Type Options Dump FSCK

I P Address (server) : /data/ files /mnt/nfs nfs soft,nfsvers= 2 0 0

Note: There are many versions of NFS but the most popular is version 2. To be safe,
use the NFS server to export version 2 directories by using the nfsvers= 2 option in
/etc/ fstab file as shown above.
3.6. To active the above created mount point,
# mount –a
3.6.1. Manual
The manual mount will remain till you will not restart the machine so it is not
permanent. Create the mount point directory if not created above,
$ mkdir /mnt/nfs
$ mount -t nfs IP Address (Server): /data/ files /mnt/nfs





4. Deleting, Moving Or Modifying A Share

To remove an exported directory from the /etc/exports file you need to perform the following steps on NFS client and server.
4.1. Client
4.1.1. Unmount the NFS mount point /mnt/nfs directory from the client using the
following command. $ umount /mnt/nfs
Note: You will have to update /etc/ fstab file if you have entries for auto mounting at each reboot.
4.2. Server
4.2.1. Remove the entries in the NFS server’s /etc/exports file and reload with the
following commands. $ exportfs -ua



Review Date
Reviewed Item
NFS Configuration
Author Rating

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on NFS Configuration"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.