Welcome to Machine Unix

Search Below

Configuring Centos 6 VM NFS client on SmartOS with SDC

If you are using one of the Centos 6 datasets in SmartDataCenter, it is a breeze to setup an NFS client.

Centos6 and the VM provided use “service” utility to start the necessary services at boot time and some of those services are “off” by default in a stock kernel such as in the dataset centos-6:1.0.1.

To configure the NFS client, I have the following procedure on a clean centos6 image.

1) Install the NFS utilities

# yum install nfs-utils nfs-utils-lib

Loaded plugins: fastestmirror, presto
Determining fastest mirrors
* base: mirror.5ninesolutions.com
* extras: mirrors.usc.edu
…..

2) Create your shared directory

# mkdir /shared

3) Edit your fstab entry to reflect the following:

#
# /etc/fstab
# Created by anaconda on Fri Nov 18 12:49:42 2011
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk’
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/vda1 / ext4 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/swapfile1 swap swap defaults 0 0
/dev/vdb1 /data ext4 defaults 0 0
10.0.0.10:/shared /shared nfs rw,users,nolock

In this case 10.0.0.10 is my NFS server and /shared in the second column is where we are mounting it ( see step 2)

4) Now inorder to get rpcbind working at the reboot, you need to turn on couple of services, and these are namely nfs and netfs.

You turn these services on with chkconfig command with the runlevels you need ( See the Centos Guide ). Make sure the commands are in the following order.

# chkconfig –level 345 nfs on
# chkconfig –level 345 netfs on

5) At this point make sure you added and made sure your NFS server has permissions setup for your NFS client.

6) Mount your share:

# mount /shared

# df -h

[root@centoscl8 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 9.9G 2.4G 7.0G 26% /
tmpfs 248M 0 248M 0% /dev/shm
/dev/vdb1 9.9G 151M 9.2G 2% /data
172.0.10.10:/shared 5.0G 799M 3.9G 17% /shared

7) (optional) Reboot your client now so that you can see the mounts survive across reboots:

# reboot

8) Check to see if rpcbind is up and running:

[root@centoscl8 ~]# service rpcbind status
rpcbind (pid 1052) is running…

[root@centoscl8 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 9.9G 2.4G 7.0G 26% /
tmpfs 248M 0 248M 0% /dev/shm
/dev/vdb1 9.9G 151M 9.2G 2% /data
10.0.0.10:/shared 5.0G 799M 3.9G 17% /shared

Now that you configured your client, you can store your files. By the way, if you have not already done so, go ahead and check Joyent’s SDC product and fire away your guns! Also make sure to check out this entry for more information on mounts.