Saturday, May 18, 2013

How to mount a WD Book Live as NFS in OEL6U3

Scenario: I have a Windows 8 (Host) laptop on which I am running two OEL6U3 (Guest) machines in a Virtual Box. I want to have a shared mount between the two Linux machine which will allow me to read/write from both the machines concurrently. Its a very common scenario for a High Availability Environment.

Virtual Box provides a facility of creating sharable VDI disks which can be mounted on multiple machines, but it doesn’t allow concurrent read/write access from multiple machines.

If you are installing RAC database then its still achievable, because ASM will provide the feature of concurrent read/writes, but if you want to install a WebLogic cluster with High Availability the recommended approach would be to have a Shared Mount.

Step to create a shared nfs mount is fairly simple. I am using a WD My Book Live, and will mount the Public folder as shared mount

1. Get the hostname/ip of the WD device.

2. On the Linux Machine 1 create the folder where you want to mount the nfs
cd /
mkdir shared

3. On the Linux Machine 1 add the entry in fstab
vi /etc/fstab
<WD IP Address>:/nfs/Public    /shared     nfs     Default 0 0

4. Test it
mount –a

This will work only if the Public folder is accessible through anonyms login

If you want to access a Private folder say, shared_oracle which is owned by user oracle in the WD My Book Live then execute the following in the WD My Book Live before you attempt to mount in the Linux 1 Machine

1. Enable ssh access by log into http://mybooklive/UI/ssh and enable the SSH Access check box

2. Log in to mybooklive using putty and user as root.

3. Execute the command
id oracle

The output will be similar to
MyBookLive:/# id oracle
uid=1002(oracle) gid=1000(share) groups=1000(share),33(www-data)

4. Edit the export file
vi /etc/exports

add the entry
/nfs *(rw,all_squash,sync,no_subtree_check,insecure,anonuid=1002,anongid=1000)

The anonuid in the command above should be the uid of user ‘oracle’

5. Restart nfs server (WD My Book Live)
invoke-rc.d nfs-kernel-server restart

Thats all, you are ready to use the drive as a NFS mount.

No comments: