Welcome to

LINUX WORLD

Rohit Mehta : A Linux Follower

bangalore, Karnataka, India
hi! i m a person who is chill all time. Since jan 2008 i am working for Novell software. The word Impossible does not exist in my dictionary because Impossible says i m possible...hey guys have fun with linux...it begins but has no end......

Tuesday, November 17, 2009

How To Make A NFS Share


http://funlinuxfun.blogspot.com/
nfsNFS(Network File System) is a viable solution for sharing disk space between two linux/unix machines/servers. NFS uses a standard client/server architecture. The server portion consists of physical disks containing shared file system and several daemons that make shared file system visible and available for use by NFS clients. NFS clients simply mount the exported file system, known as NFS mounts.
Note: While making a nfs share we should export directories only under / directory and only the local file systems.
Some of the important nfs daemons are:
.rpcbind
.nfs
.netfs
.nfslock
.portmapper
Steps for making a NFS share and exporting the nfs share to the client:
Step1.)Generally all the linux versions comes with the nfs package installed. One can check using:
#rpm –aq |grep nfs
redhat-config-nfs-1.1.3-1
nfs-utils-1.0.1-3.9
Step2.) Configure the /etc/exports file. It is the main nfs configuration file and has two columns.
The first column lists the directories you want to make available to the network. The second column has two parts. The first part lists the networks or DNS domains that can get access to the directory, and the second part lists NFS options in brackets.
eg:
/home 192.168.1.0/24(rw,sync) #this meas that home directory is exported to 192.168.1.0 domain
with read,write permissions.
sync option ensures that file data cached in memory is automatically written to the disk after the completion of any disk data copying operation.
rw can be replaced by ro for making the share read only.
Step 3. ) Use chkconfig command to start nfs services at the boot time
# chkconfig nfs on
# chkconfig nfslock on
# chkconfig rpcbind on
Step 4.)Use the init scripts in the /etc/init.d directory to start the nfs and RPC rpcbind daemons.
#service rpcbind start
#service nfs start
#service nfslock start
Step 5.)Check nfs services by:
#rpcinfo -p #for local machine
#rpcinfo -p hostname #for remote machine
Step 6.)We can check the mounts using:
#showmount -e
Step 7.)When no directories have yet been exported to NFS, use the following command.
#exportfs -a
When adding a shared directory, you can use the following command to export only the new entries.
#exportfs -r
Step 8.)Configuring the nfs client:
Start the nfs daemons on the nfs client also:
Use the chkconfig command to configure the required nfs and RPC rpcbind daemons to start at boot:
#chkconfig nettfs on
#chkconfig nfslock on
#chkconfig rpcbind on
Use the init scripts in the /etc/init.d directory to start the nfs and RPC rpcbind daemons:
# service rpcbind start
# service netfs start
# service nfslock start
Test whether NFS is running correctly:
#rpcinfo -p
Step 9.)On the nfs client add the shared mount entry in the /etc/fstab file:
vi /etc/fstab
#Directory Mount Point Type Options Dump FSCK
192.168.1.100:/home /mnt/nfs nfs defaults 0 0
save and quit from the file
Reload the fstab file by:
#mount -a
Step 10.)Now we can access the nfs share by going into directory in which we have mounted the export on the client side.

No comments:

Which Linux distribution has ease of use?