Saturday, October 6, 2012

NFS Sharing

Network File System Sharing is used for sharing the files/directory all through the network

port 2049

files used are

@ /usr/sbin

1.Server --- place from which we need to share the directory

---->yum install -y nfs-utils*
---->service nfs restart
---->chkconfig nfs on
---->vim /etc/exports

In this file we say about files we need to share ,the mode in which the files are to shared and network to which the files are to be shared

some of the modes in which directories can be shared are

---->exportfs -r

----****we should set the proper context ,sebool and setfacl for needed user

---->getsebool -a | grep nfs

this will list the needed Boolean we must set it according to the needs

---->setfacl -m u:nfsnobody:rwx /nfs

this will allow the nfsnobody user to use the /nfs directory this is needed if we are giving the write option to the directory

if more problems occur while sharing the directory we should also check the context for selinux or disable the selinux

showmount -e
will list the all the nfs shared directory by the server

2.Client --- where we will mount the shared directories
there are multiple ways to mount the directory

---->yum install -y nfs*
---->service nfs restart
---->chkconfig nfs on

a.every shared folders will be available at /net every time as readonly type we use that as following ,for first example of sharing

---->cd /net
---->cd cd nfs

b.We can also mount the directory by simple mount command
mount nfs:// /data

one of the main default of this system is that if we give the entry for mount in fstab and server goes down and if we restart the client ,the client will have boot break to over come this problem we use autofs mounting systems

c.using autofs mounting system

here first we will edit /etc/auto.master file

---->vim /etc/auto.master

/data /etc/auto.nfs

---->vim /etc/auto.nfs

nfs -rw

----->service autofs reload
----->chkconfig autofs on

here after reloading the autofs service we could browse to that folder
---->cd /data
---->cd nfs


  1. Useful info. Lucky me I discovered your site accidentally, and I am shocked why this
    accident didn't took place in advance! I bookmarked it.

  2. Valuable info. Lucky me I discovered your site by accident,
    and I'm surprised why this twist of fate did not came about earlier! I bookmarked it.