Setting up a shared file system on SAN with OCFS2

Requirements & Scenario

Two High Availability Centos servers sharing same SAN partition

Server 1 ( |————| SAN |————-| ( Server 2


Installation of OCFS2 filesystem, a shared cluster file system on SAN partition for parallel I/O


Follow all these steps on the two server except the one step specifically mentioned.

Step 1

Install OCFS2 packages. You have to follow the same steps on the two clustered servers.

root@serv:~# yum install glib2-devel.x86_64 e2fsprogs-devel.x86_64

root@serv:~# wget http://oss.oracle.com/projects/ocfs2/dist/files/RedHat/RHEL5/x86_64/1.4.7-1/2.6.18-194.el5/ocfs2-2.6.18-194.el5-1.4.7-1.el5.x86_64.rpm

root@serv:~# wget http://oss.oracle.com/projects/ocfs2-tools/dist/files/RedHat/RHEL5/x86_64/1.4.4-1/ocfs2-tools-1.4.4-1.el5.x86_64.rpm

root@serv:~# wget http://oss.oracle.com/projects/ocfs2-tools/dist/files/RedHat/RHEL5/x86_64/1.4.4-1/ocfs2-tools-devel-1.4.4-1.el5.x86_64.rpm

root@serv:~# rpm -ivh ocfs2-tools-devel-1.4.4-1.el5.x86_64.rpm ocfs2-tools-1.4.4-1.el5.x86_64.rpm ocfs2-2.6.18-194.el5-1.4.7-1.el5.x86_64.rpm

Step 2

Formatting partition. Format the san partition from one of the nodes ( do this from only one of the servers )

root@serv:~# mkfs.ocfs2 /dev/sdc1

Step 3

Edit fstab and add the partition

root@serv:~# vi /etc/fstab

/dev/sdc1	/dir	ocfs2	_netdev		0	0

Step 4

Configuring the ocfs2 . Add the below lines to /etc/ocfs2/cluster.conf

root@serv:~# mkdir /etc/ocfs2
root@serv:~# vi /etc/ocfs2/cluster.conf

ip_port = 7777
ip_address =
number = 0
name = node1.cluster.com
cluster = ocfs2

ip_port = 7777
ip_address =
number = 1
name = node2.cluster.com
cluster = ocfs2
node_count = 2
name = ocfs2

set O2CB_ENABLED as true on /etc/default/o2cb

root@serv:~# vi /etc/default/o2cb

Step 5

Configure o2cb, O2CB is the cluster stack of ocfs2 and it need to be configured before starting ocfs2

remove the below lines from /etc/init.d/o2cb

root@serv:~# vi /etc/init.d/o2cb

# Provides: o2cb
# Required-Start:
# Should-Start:
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop:
# Description: Load O2CB cluster services at system boot.

root@serv:~# chkconfig –del o2cb
root@serv:~# /etc/init.d/o2cb offline ocfs2
root@serv:~# /etc/init.d/o2cb unload
root@serv:~# /etc/init.d/o2cb configure

Hit enter for the questions asked and it will keep the default value

root@serv:~# /etc/init.d/o2cb load
root@serv:~# /etc/init.d/o2cb online ocfs2
root@serv:~# /etc/init.d/ocfs2 start
root@serv:~# chkconfig –add o2cb
root@serv:~# chkconfig –add ocfs2

You have configured the cluster filesystem, try some write checks from two servers on the clustered partition, keep an eye on the logs also.