Thursday, April 3, 2008

File sharing using NFS in linux

NFS : Sharing of directories/files between linux-linux, linux-unix, unix-linux is achived by NFS.
The NFS environment contains following components

NFS Server :
A system that contains the file resources to be shared with other sytem on the network.

NFS client
A System that mounts the file resources shared over the network and present the file resources as if they are local.
Requirements
1. portmap-4.0-63.i386.rpm
2.nfs-utils-1.0.6-46.i386.rpm
Configuration file : /etc/exports
Daemons :
1. nfsd
2.mountd
3.statd
4.lockd
Procedure :
1. Server side.
#rpm -ivh nfs-utils* --force --aid
#rpm -ivh portmap* --force --aid
2. How to configure nfs server. Open the file /etc/exports in vi editor
#vi /etc/exports
/home/bilton
add the location of the directory/file(for example to share /home/bilton directory add the entry as above)
#service portmap restart
#service nfs restart
Note : Whenever you edit /etc/exports please restart the services.

3. Client side.
#mkdir /nfsbilton
#service portmap restart
#mount 192.168.0.1:/home/bilton /nfsbilton
Here i have mounted shared directory(/home/bilton) which is on nfs server(192.168.0.,1) on my local system dirctory /nfsbilton.
Now you can view the shared directory under /nfsbilton as though the shared directory is residing on your local system.

Note : Although nfs server is not used widely compared to samba server, i still suggest you to know how nfs server works.
In my next blog i will write how to configure samba server.

No comments: