Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Wednesday, October 10, 2012

Setting up an NFS share

NFS (Network File System) is a protocol used by UNIX/Linux computers to share disks across a network. Similar to the Common Internet File Services (CIFS) protocol used by Windows, NFS is older and more light-weight, and performs much more efficiently on UNIX and Linux systems.


1- First connect as root and create the folder to be shared
[root@rac2 /]# mkdir rmanbkup
[root@rac2 /]# cd /rmanbkup

2- Open /etc/exports as root using your favourite text editor. If this file doesn't exist you will need to create it. Add the following to the file:

/rmanbkup 132.35.21.0/255.255.255.0(rw)
or
/rmanbkup 132.35.21.0/255.255.255.0(rw,sync,no_wdelay,insecure_locks,no_root_squ
ash)

This line shares the /rmanbkup directory with all machines on the 132.35.21.0 network and allows each machine to have both read and write access to the share. Change this network address to one that is appropriate for your network. Read only access can be specified by changing (rw) to (ro).


You can individually specify a list of machines that will have access to the share, and tailor the access each machine has to the share, using a line such as:
/rmanbkup 132.35.21.2(rw) 132.35.21.3(ro)

2- Start NFS Server ,the method used to start the NFS server will depend on your distribution. Under most distributions, e.g. Red Hat Linux, you can start the NFS server by typing in a shell as root:
[root@rac2 /]# /etc/init.d/nfs start
 
 
 3- Mount NFS share as root the machine where you want to access the share, NFS shares are mounted like a local hard disk, using the mount command.
To mount an NFS share you will need to know the hostname or IP of the NFS server and the directory on the server in which the NFS share is located.

[root@rac1 ~]# mkdir /rmanbkupShared
[root@rac1 ~]# mount -t nfs 132.35.21.178:/rmanbkup /rmanbkupShared

Some Useful NFS commands:

To see what filesystems are exported
[root@rac2 /]# exportfs
/rmanbkup      

 use exportfs -ra to force NFS to re-read the configuration.
[root@rac2 /]# exportfs
/rmanbkup      
[root@rac2 /]# exportfs -ra
[root@rac2 /]# exportfs
/sh            

No comments: