Google+

Saturday 11 January 2014

NFS-Server and Client configuration in Linux

NFS- Network File System is the commonly used to share files over the network.It is widely used in UNIX-Linux based environments. NFS protocol is also used in Netapp storage for importing files to clients. NFS came across various improvements from verisons 1,2,3 and 4.
NFS 4.1 is in development stage.


NFS Server configuration in Linux[NFS version 3]



Command to install the NFS package


# yum install nfs*

Create export file to enter the NFS share details


# vim /etc/exports
/data/file1            *(ro,sync)
/home                 192.168.1.0/24(rw,sync)
/data/folder1            *.test.com(rw,sync)
/data/database1        192.168.1.203/32(rw,sync)
  

Explanation:


Read-only access to the /data/file1 directory to all networks

Read/write access to the /home directory from all servers on the 192.168.1.0 /24 network, which is all addresses from 192.168.1.0 to 192.168.1.255

Read/write access to the /data/folder1 directory from servers in the test.com DNS domain

Read/write access to the /data/database1 directory from a single client 192.168.1.203.


Command to reload the NFS configuration file[show errors in config file, if errors available]


# exportfs  -r

Command to restart the NFS services


# service  nfs  restart
# service  nfslock  restart

Command to start the NFS services on boot time


# chkconfig  nfs  on
# chkconfig  nfslock  on

To view the exported NFS mount points from the server


# showmount  -e

NFS Client side configuration in Linux


To view the exported NFS shares from a particular server(192.168.2.1)


# showmount  -e  <192.168.2.1>
# mount  -t   nfs   192.168.2.1:/data/files  /media

To mount the NFS share permanently after reboot


# vim /etc/fstab
                     Directory                 Mount Point    Type    Options      Dump  FSCK
192.168.2.1:/data/files   /media        nfs       defaults     0       0


#mount  -a


nfs-architecture