OCFS2: Oracle's Cluster File System
Introduction
OCFS2 is a cluster filesystem that allows sharing filesystems between multiple machines with fault tolerance.
This file system was initially created for Oracle databases and therefore has a locking mechanism designed for this type of application. You can use it as a file system, but the problem is that it may flush old locks after a certain period. If your idea is really to use a cluster filesystem to store files, it would be better to turn to GFS.
Installation
By default, OCFS2 is compiled as a module in the kernel. To ensure this, we can check the kernel config
file:
which should return:
Let's install the necessary tools:
Configuration
cluster.conf
Add this to the /etc/ocfs2/cluster.conf
file. Be careful, it's very picky, so include only what is strictly necessary with tabs, etc., and no superfluous lines:
I don't think I need to provide many explanations, as the configuration file is clear. But here are some just in case:
- node_count: number of nodes in the cluster
This configuration should be applied to all of your nodes.
o2cb
Now let's edit the OCFS2 startup file:
You just need to modify O2CB_ENABLED and O2CB_BOOTCLUSTER, indicating the name of the OCFS2 cluster.
Startup
There is a graphical tool for managing ocfs2, "ocfs2console", but we won't cover it here.
To properly start ocfs2 (necessary after each configuration change):
For subsequent reboots:
Formatting
You can now format the device you want with OCFS2 using the mkfs.ocfs2 command:
Now just mount this on your nodes: