Monday, July 16, 2012

Network File System (NFS)

NFS - Network File System is used to share file between Linux platforms.

Required packages: nfs_util
Port No: 2049,111
configuration file: /etc/exports
Services : rpcbind, nfs
Demon: nfs.quotad, nfs.mountd, portmap
Protocol Used: rpc

Steps to create NFS share


1. Install required packages
yum install nfs*

2. Create share directory
mkdir -p /home/share

3. Add the share details to /etc/exports. (Usually this file will be empty)
Template:
<sharename> <Client IP>(permission)
Example:
/home/share 192.168.1.15(rw,no_root_squash)

4. Restart services
service rpcbind restart
service nfs restart

5. Refresh the changes
exportfs -avr

5. List NFS drives
#From Server side
showmount -e
#From Client side
showmount -e
showmount -e 192.168.1.7

6. Now mount the NFS mount points
# Backup /etc/fstab
cp -pr /etc/fstab /etc/fstab_backup

#Temporary Mounting
mount -t nfs <hostname>:<shared location>  <Mount Point> 
mount -t nfs 192.168.1.7:/home/share /mnt

#Permanent Mounting. 
#Add the following line in /etc/fstab
<hostname>:<shared location>  <Mount Point> nfs  <permission> <Backup Available> <fsck priority>

192.168.1.7:/home/share  /mnt  nfs defaults  0   0

#Restart deamon
systemctl daemon-reload

#Mount all
mount -a

#Check mountpoint visible
df -h

#Check access
cd /mnt
ls -lrt

Enhanced by Zemanta

No comments:

Post a Comment