Monday 16 May 2011

NFS


Network File System (NFS)

Network File System (NFS) is a way to share files between machines on a network as if the files were located on the client's local hard drive. Red Hat Linux can be both an NFS server and an NFS client, which means that it can export file systems to other systems and mount file systems exported from other machines.
The Network File System is certainly one of the most widely used network services. Network file system (NFS) is based on the Remote procedure call. It allows the client to mount and therefore, transparently access the remote file systems on the network.

NFS has 5 daemons:

Server Demon                                 Client Demon
1.    mountd                                          1.   statd
2.    statd                                              2.   lockd
3.    lockd
4.    nfsd
5.    nfslogd

Configuration file:
1.            /etc/exports

Sharing Method of Network File System:

# vi /etc/exports

(i)         /home/nfs     *
(ii)        /home/nfs     192.168.1.2
(iii)       /home/nfs     192.168.1.0/255.255.255.0(rw,sync)
(iv)      /home/nfs     192.168.1.0/24(rw,sync)
(v)       /home/nfs     *(rw,no_root_squash)

           Here are the most common export techniques and options:
/home/nfs/ 10.1.1.100(rw,sync)               export /home/nfs directory for host with IP 10.1.1.100 with read, write permissions, and synchronized mode
/home/nfs/ 10.1.1.0/24(ro,sync)               export /home/nfs directory for network 10.1.1.0 netmask 255.255.255.0 with read only permissions and synchronized mode
/home/nfs/ 10.1.1.100(rw,sync)               10.1.1.10(ro,sync)    export /home/nfs directory for host with IP 10.1.1.100 with read, write permissions, synchronized mode, and also export /home/nfs directory for hosts with IP 10.1.1.10 with read only permissions and synchronized mode
/home/nfs/ 10.1.1.100(rw,sync,no_root_squash)       export /home/nfs directory for host with IP 10.1.1.100 with read, write permissions, synchronized mode and the remote root user will be treated as a root and will be able to change any file and directory.
/home/nfs/ *(ro,sync)                                  export /home/nfs directory for any host with a read only permission and synchronized mode
/home/nfs/ *.linux.org(ro,sync)                export /home/nfs directory for any host within linux.org domain with a read only permission and synchronized mode
/home/nfs/ localhost(rw,sync)                 export /home/nfs directory for hostname localhost with read, write permissions and synchronized mode

# chkconfig nfs on
# chkconfig portmap on
# service nfs restart
# service portmap restart


Mount remote file system on client:
First we need to create a mount point
# mkdir /nfs

Mount remote file system on the mount point
# mount 192.168.1.3:/home/nfs /nfs


Note: Anytime when make any changes to the "/etc/exports" file on the nfs server, run the command to update the nfs server. 
# exportfs –avr






No comments:

Post a Comment

Boot to UEFI Mode or legacy BIOS mode

Boot to UEFI Mode or legacy BIOS mode Choose UEFI or legacy BIOS modes while installing Windows. After Windows is installed, if you nee...