Tuesday, July 20, 2010

Sharing Folder between Linux/UNIX systems using NFS

1. Create the folder which we want to share
mkdir /nfs1
chmod 666 /nfs1
2. Share the folder by entering its details in /etc/exports file. In the /etc/exports file, enter the following:
/nfs1       192.168.1.60(rw) [This means this folder can be accessed by 192.168.1.60 in read-write mode]
/nfs2        172.30.10.0/24
3. Start service
service nfs start
ckconfig nfs on
4. Export the file (publishing):
exportfs –v
note: if we add more folder then we can update the exports using exportfs –a
5. Done!!!

How to access these shared folders from the remote 192.168.1.60 system
1. Create a corresponding directory anywhere say nfs1
mkdir /nfs1
2. Mount the remote shared directory (192.168.1.50) to that this directory
mount –t nfs 192.168.1.50:/nfs1 /nfs1
3. Use the “df –h” or “mount” command to confirm it and we are done!!!

Additional configurations
1. Allow client/remote 'root' user the ability to write to /nfs1 export
/etc/exports: (rw,no_root_squash)
2. Setup mount points so that they're available upon reboot
Edit /etc/fstab
192.168.1.50:/nfs1      /nfs1                   nfs     defaults  0 0
note : Unmount and confirm that NFS mount points will be available when the client system changes runlevels (reboots, starts, etc.) - 'mount –a'

3.  showmount -a 192.168.1.50 - shows mounts on this system (connected NFS clients)

No comments: