These are written for Debian Squeeze.
apt-get install ocfs2-tools
Suppose we want 2 nodes, node1 and node2, to share the fs.
Create file /etc/ocfs2/cluster.conf:
node:
ip_port = 7777
ip_address = 192.168.0.101
number = 0
name = node1
cluster = ocfs2
node:
ip_port = 7777
ip_address = 192.168.0.102
number = 1
name = node2
cluster = ocfs2
cluster:
node_count = 2
name = ocfs2
Config the o2cb config file /etc/default/o2cb by:
dpkg-reconfigure ocfs2-tools
Or by hand.
Remember to start the o2cb service.
invoke-rc.d o2cb start
You may need to online the o2cb cluster if you are joining a running one:
/etc/init.d/o2cb online
mkfs.ocfs2 --fs-feature-level=max-features /dev/sdb1
At all nodes:
mount.ocfs2 -o _netdev,noatime,data=writeback /dev/sdb1 /mnt/ocfs
After success, you may something like these in dmesg
[ 1434.813381] o2net: connected to node node1 (num 0) at 192.168.0.101:7777
[ 1437.729493] ocfs2_dlm: Node 0 joins domain 571B1A408C6A486CA07FE1E2D0785806
[ 1437.729588] ocfs2_dlm: Nodes in domain ("571B1A408C6A486CA07FE1E2D0785806"): 0 1
And o2cb status:
node2:~# /etc/init.d/o2cb status Driver for "configfs": Loaded Filesystem "configfs": Mounted Stack glue driver: Loaded Stack plugin "o2cb": Loaded Driver for "ocfs2_dlmfs": Loaded Filesystem "ocfs2_dlmfs": Mounted Checking O2CB cluster ocfs2: Online Heartbeat dead threshold = 31 Network idle timeout: 30000 Network keepalive delay: 2000 Network reconnect delay: 2000 Checking O2CB heartbeat: Active
node2:~# umount /mnt/ocfs node2:~# /etc/init.d/o2cb status Driver for "configfs": Loaded Filesystem "configfs": Mounted Stack glue driver: Loaded Stack plugin "o2cb": Loaded Driver for "ocfs2_dlmfs": Loaded Filesystem "ocfs2_dlmfs": Mounted Checking O2CB cluster ocfs2: Online Heartbeat dead threshold = 31 Network idle timeout: 30000 Network keepalive delay: 2000 Network reconnect delay: 2000 Checking O2CB heartbeat: Not active <=== changed from Active to Not active node2:~# /etc/init.d/o2cb offline Stopping O2CB cluster ocfs2: OK Unloading module "ocfs2": OK