Monday, 16 February 2009

setting up NFS server and clients

Setting up NFS:

NFS servers lets other systems access their file systems by sharing them over the NFS environment.

A shared file system is referred to as a shared resource.

You can specify which file systems are to be shared by entering information in the file /etc/dfs/dfstab. Entries in this file are shared automatically whenever you start the NFS server operation. The /etc/dfs/dfstab file lists all the file systems your NFS server shares with its NFS clients.

Configuring NFS to the resources shown in Diagram (see bottom).

At NFS server :In Diag. : sunserver

1) Sharing /database directory on sun server (adding its entry in /etc/dfs/dfstab file by editing the file with vi editor.)
# vi /etc/dfs/dfstab
it has the following format,
share [ -F fstype ] [ -o options ] [ -d “” ] \ [ resource ]

where
-F — specifies the file system type, such as NFS.
-o –specifies ‘rw’ , ‘ro’ options for clients to access shared resource.
-d –provides a description of the resource being shared.
— name of the file system to be shared.

For eg.( diagram A):
share -F nfs -o ro -d “Project Database” /database
:wq!(save & quit)

2) After you edit the /etc/dfs/dfstab file ,restart the NFS server by either rebooting the system or by typing this,
# svcadm restart nfs/server

3)Verify the NFS share by executing one of the following commands.
# dfshares
or # exportfs



At NFS client :In Diag.A : station1 (assuming having solaris os)

1)Create the mountpoint to mount the share temporarily.
# mkdir /rdatabase

2) Mount the share temporarily .
# mount -F nfs 192.168.0.100:/database /rdatabase
now check by entering in a particular directory i.e.here in this case /rdatabase.

3)If you would like this file system to be mounted automatically at every startup,then you can add the following line to the /etc/vfstab file.
# vi /etc/vfstab
192.168.0.100:/database — /rdatabase nfs — yes — ro
:wq!(save & quit)

4) Reboot the system or without reboot execute the command.
# mountall

It reads /etc/vfstab file & mounts all file systems;



courtesy of http://sharetab.com/solaris-setting-up-nfs-network-file-sharing-server/

No comments: