Setting Up NFS on Oracle/Red Hat Linux 6

This guide provides instructions on configuring NFS to be used for votedisk (quorum disk) on Oracle Extended RAC. All the commands should be executed as root user on the NFS Server (nsfsrv1 in this guide) except where noted.


Step 1 – Install the following packages: nfs-utils, nfs-utils-lib, rpcbind.


# yum install nfs-utils nfs-utils-lib

Step 2 – Verify the packages are installed.


# yum list installed nfs-utils nfs-utils-lib rpcbind
Loaded plugins: security, ulninfo
Installed Packages
nfs-utils.x86_64                                          1:1.2.3-64.el6                                       @anaconda-OracleLinuxServer-201507280245.x86_64/6.7
nfs-utils-lib.x86_64                                      1.1.5-11.el6                                         @anaconda-OracleLinuxServer-201507280245.x86_64/6.7
rpcbind.x86_64                                            0.2.0-11.el6                                         @anaconda-OracleLinuxServer-201507280245.x86_64/6.7

Step 3 – Enable these 3 services on boot.


# chkconfig rpcbind on
# chkconfig nfs on
# chkconfig nfslock on

Step 4 – Start the services.


# service rpcbind start
Starting rpcbind:                                          [  OK  ]
# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
# service nfslock start
Starting NFS statd:                                        [  OK  ]

Step 5 – Create the user who will own the share directory.

Create the group we will need.


# groupadd -g 900 oinstall

Create the user.


# useradd -u 921 -g oinstall -d /home/grid -s /bin/bash grid

Set the password for user grid.


# passwd grid

Step 6 – Set the uid and gid to grid user and oinstall group. all_squash tells NFS that for any user connecting from rac1 and rac2, treat them as uid=anonuid and gid=anongid.

Get the uid and gid for grid.


# id grid
uid=921(grid) gid=900(oinstall) groups=900(oinstall)

Step 7 – Create the share directory.


# mkdir /votedisk

Step 8 – Get the uid and gid for grid.


# id grid
uid=921(grid) gid=900(oinstall) groups=900(oinstall)

Step 9 – Add this to /etc/exports. It will allow rac1 and rac2 to do an nfs mount to the specified directory. It will set the uid and gid to grid user and oinstall group, respectively. all_squash tells NFS that for any user connecting from rac1 and rac2, treat them as uid=anonuid and gid=anongid. Replace rac1 and rac2 with your actual hostnames.


/votedisk rac1(rw,sync,all_squash,anonuid=921,anongid=900) rac2(rw,sync,all_squash,anonuid=921,anongid=900)

Step 10 – Allow access only from rac1 and rac2.

Add these 4 lines to end of /etc/hosts.deny. This will prevent every machine from accessing the nfs mount unless they are specifically allowed in the /etc/hosts.allow.


lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL

Add these lines to the end of /etc/hosts.allow.


lockd: rac1, rac2
rquotad: rac1, rac2
mountd: rac1, rac2
statd: rac1, rac2

Step 11 – Re-export the new export directory so it take effects.


exportfs -a

Step 12 – On rac1 and rac2, create a new directory to be used for mounting.


mkdir /voting_disk

Step 13 – On rac1 and rac2, add this entry into /etc/fstab. The options are only required for Oracle.


nfssrv1:/votedisk /voting_disk nfs rw,bg,hard,intr,rsize=32768,wsize=32768,tcp,noac,vers=3,timeo=600 0 0

Step 14 – Mount it on rac1 and rac2.


# mount /voting_disk

Step 15 – Verify it is mounted.


# df -h /voting_disk
Filesystem        Size  Used Avail Use% Mounted on
nsrsrv1:/votedisk   50G   11G   40G  22% /voting_disk


Troubleshooting

If you are not able to access the share, check your firewall settings. You can temporarily turn off firewall to verify it is not the cause of the problem.


service iptables stop

To start it back up.


service iptables start

Leave a Reply