Learn Linux NFS Mount Options in Detail

NFS Linux

About NFS (Network File System) And Options to Mount

NFS is a client and server architecture based protocol, developed by Sun Microsystems. The main purpose of this protocol is sharing file/file system over network. In general, files/file system sharing between two UNIX machines. User on client computer access remote file system over a network in manner similar to how local storage accessed.

Here we will discuss, how to access NFS share (exports) from the client.

Assuming that HOST A (NFS Server) running NFS service (rpc.mountd, nfsd, rpc.rquotad). Also you can confirm by executing following command on NFS Server.

[root@localhost ~]# service nfs status
rpc.mountd (pid 2919) is running...
nfsd (pid 2916 2915 2914 2913 2910 2909 2908 2907) is running...
rpc.rquotad (pid 2903) is running...
[root@localhost ~]#

Now login to the HOST B (NFS Client) execute following command, to find out shared directories in the NFS Server.

[root@localhost ~]# showmount -e 192.168.1.4
Export list for 192.168.1.4:
/mnt/array1/RHEL5 192.168.1.0/255.255.255.0
/mnt/array1/RHEL632 192.168.1.0/255.255.255.0
[root@localhost ~]#

While entering showmount command, you have to specify IP/Hostname (FQDN) of the NFS Server. After getting exported file system information, you can access by the mount command.

[root@localhost ~]# mount -t nfs 192.168.1.4:/mnt/array1/RHEL5 /data/

Before mounting remote file system, first create mount point, here I have created /data directory and mounted remote file system.

Syntax:

#mount -t vfstype [-o options] NFS Servername:/exporteddirectory /mount point
or
#mount -t nfs -o options host:/remote/export /local/directory

Options:

-t - Option specifies type of the file system that is NFS.
-o intr—this option is used in non reliable network, or network having more network congestion. NFS request will be interrupted when server is not reachable.

Example:

[root@localhost ~]# mount -t nfs -o intr 192.168.1.4:/mnt/array1/RHEL5 /data/
[root@localhost ~]# mount | grep -i intr
192.168.1.4:/mnt/array1/RHEL5 on /data type nfs (rw,intr,addr=192.168.1.4)

Hard – if hard option is specified during nfs mount, user cannot terminate the process waiting for NFS communication to resume.

Example:

[root@localhost ~]# mount -t nfs -o hard 192.168.1.4:/mnt/array1/RHEL5 /data/
[root@localhost ~]# mount | grep -i hard
192.168.1.4:/mnt/array1/RHEL5 on /data type nfs (rw,hard,addr=192.168.1.4)

Soft- if soft option is specified during nfs mount, user will get error alert when NFS server is not reachable.

Example:

[root@localhost ~]# mount -t nfs -o soft 192.168.1.4:/mnt/array1/RHEL5 /data/
[root@localhost ~]# mount | grep -i soft
192.168.1.4:/mnt/array1/RHEL5 on /data type nfs (rw,soft,addr=192.168.1.4)
[root@localhost ~]#

Nfsvers=value-- if this option is specified during nfs mount NFS client uses particular NFS protocol version to communicate.

Example:

[root@localhost ~]# mount -t nfs -o nfsvers=3 192.168.1.4:/mnt/array1/RHEL5 /data/
[root@localhost ~]# mount | grep -i nfsvers
192.168.1.4:/mnt/array1/RHEL5 on /data type nfs (rw,nfsvers=3,addr=192.168.1.4)

Tcp or UDP: As said above, NFS is client and server architecture based protocol and it can be used transport layer as TCP and UDP both depend upon the application requirement.

Example: TCP

[root@localhost ~]# mount -t nfs -o tcp 192.168.1.4:/mnt/array1/RHEL5 /data/
[root@localhost ~]# mount | grep -i tcp
192.168.1.4:/mnt/array1/RHEL5 on /data type nfs (rw,tcp,addr=192.168.1.4)

Example: UDP

[root@localhost ~]# mount -t nfs -o udp 192.168.1.4:/mnt/array1/RHEL5 /data/
[root@localhost ~]# mount | grep -i udp
192.168.1.4:/mnt/array1/RHEL5 on /data type nfs (rw,udp,addr=192.168.1.4)

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

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

All comments are subject to moderation.