Wednesday, June 24, 2009

NFS (Network File System) Server Configuration.

Step 1:- Make a Directory which you want to share by NFS Server.
e.g. i want to share a directory who's name is mydata which is on / .

mkdir /mydata
mkdir /rahul
mkdir /sale

Step2:- NFS server configuration

vi /etc/exports

/mydata *.rahul.com(ro,sync)
or
/rahul 192.168.0.0/255.255.255.0(rw,async)
or
/sale *(rw)


Press ESC key

:wq!

Where ro — Mounts of the exported file system are read-only.
rw — Mounts of the exported file system are read-write.
async-Allows the server to write data at non-regular intervals. This setting works best if the exported file system is read-only. If the exported file system is read/write and hosts are making changes to the file system when the server crashes, data can be lost.
sync-option, all file writes are committed to the disk before the write request by the client is completed.

*.rahul.com- This is called wildcard option.It allow to access allow /mydata to it.rahul.com and sale.rahul.com or anything before rahul.com.

192.168.0.0/255.255.255.0- It share /rahul for entire subnet of 192.168.0.
/sale *(rw)- It share /sale directory for any type of domain,subnet or ip address.




Step2:- Now start NFS services

1. service portmap start
2. service nfs start

For permanent start NFS services
3. chkconfig --level 35 portmap on

4. chkconfig --level 35 nfs on

Step3 :- showmout
To Verify NFS server directories has been shares successful or not .
showmout -e rahul
OR

showmout -e ip address of nfs server.


Step 4:- Temporary Mouting share at client
Create a directory for access NFS server's data.
e.g. /nfsdata

mkdir -p /mnt/nfsdata

mount 192.168.0.120:/mydata /mnt/nfsdata

OR

mount -t nfs 192.168.0.120:/mydata /mnt/nfsdata

Where 192.168.0.120 is my NFS Server's Ip address .my data is my NFS server's directory and nfsdata is directory at client in /mnt .


Step 5:- For Permanent Mounting at client.

vi /etc/fstab

mount -t nfs 192.168.0.120:/mydata /mnt/nfsdata nfs defaults 0 0

Press ECS key

:wq!

Step 5a:- Hot initialize fstab (without restart client) .
mount -a


Step 5b:- To access NFS server's data at NFS Client.

cd /mnt/nfsdata

No comments:

Post a Comment