Configure Classic Multi-Attach Block Storage with OCFS2
Learn how to set up a shared OCFS2 cluster filesystem across multiple instances using a Classic Multi-Attach Block Storage volume in 3AZ regions
Introduction
When using Classic Multi-Attach Block Storage, multiple instances can read and write to the same volume simultaneously. Standard filesystems such as EXT4 or XFS are not designed for concurrent multi-node access and can lead to data corruption in this scenario.
OCFS2 (Oracle Cluster File System 2) is a cluster-aware filesystem that coordinates concurrent writes across nodes, making it a suitable choice for Classic Multi-Attach volumes.
This guide walks through creating a 3-node OCFS2 cluster backed by a single classic-multiattach block volume in a 3AZ Public Cloud region.
The classic-multiattach volume type is only available in 3AZ regions (e.g., Paris).
Requirements
- An OpenStack client installed and configured
- An OVHcloud Public Cloud project in a 3AZ region
Architecture overview
The setup consists of 3 instances — one per availability zone — all attached to the same multi-attach volume, connected via a shared private network.
Create the infrastructure
Create a private network and subnet
Create a gateway
Create the multi-attach block volume
Create an SSH keypair (skip if you already have one)
Create three instances, one per availability zone
Attach the volume to all three instances
Attach a floating IP to instance-a (for SSH access)
Retrieve the private IP of each instance
Note down the three private IPs — you will need them in the OCFS2 configuration.
Configure OCFS2
The following steps must be performed on all three instances. Start with instance-a (via floating IP), then SSH from instance-a to instance-b and instance-c using agent forwarding.
SSH to instance-a
On each instance: install OCFS2
On each instance: create the cluster configuration
On each instance: enable the O2CB cluster service
On instance-a only: format the volume with OCFS2
This step must be performed once only on one node.
The -N option sets the maximum number of node slots for the filesystem. This value can be increased later with tunefs.ocfs2, but it can never be reduced, so it is set here to match the 3 nodes used in this cluster.
On each instance: mount the filesystem
Verify the cluster
On instance-a, write a test file:
SSH to instance-b from instance-a:
Verify the file is visible:
If the file appears, the OCFS2 cluster is functioning correctly and the shared volume is accessible from all nodes.
Go further
- For automated deployment using Terraform, see the public-cloud-examples repository
- Proper usage and limitations of Classic Multi-Attach Block Storage
Join our community of users.