Enterprise Linux clustering requires more than just failover — it requires coordinated access to shared storage. In this lab you will explore cluster storage architectures including GFS2 and OCFS2 cluster filesystems, DRBD block-level replication, DLM distributed lock management, cluster LVM, and fencing devices that protect data integrity in split-brain scenarios.
Learning Objectives:
Distinguish shared-nothing vs shared-disk cluster architectures
Understand GFS2/OCFS2 cluster filesystem concepts and configuration
💡 Tip: In a real production environment, you would also install drbd-utils, gfs2-utils, ocfs2-tools, and dlm-controld. These require kernel modules and real block devices — Docker containers use the host kernel.
💡 Tip: DRBD Protocol C is synchronous — the write is only acknowledged to the application when BOTH nodes have written the data to disk. This guarantees zero data loss on failover but adds write latency proportional to network RTT. Use Protocol A for geo-replication where some data loss is acceptable.
Step 4: GFS2 — Global Filesystem 2
GFS2 is a cluster filesystem allowing simultaneous read/write from multiple nodes on shared storage:
📸 Verified Output:
💡 Tip: GFS2 requires fencing (STONITH). Without proper fencing, if a node fails mid-write, surviving nodes cannot be sure the failed node stopped writing. The filesystem could be corrupted. Never disable STONITH on a GFS2 cluster.
Step 5: OCFS2 — Oracle Cluster Filesystem 2
OCFS2 is Oracle's cluster filesystem, better suited for VM image storage and databases:
📸 Verified Output:
Step 6: DLM — Distributed Lock Manager
DLM provides distributed locking services for GFS2, OCFS2, and cluster LVM:
📸 Verified Output:
💡 Tip: DLM lockspace names must be unique and match between all cluster nodes. GFS2 uses lock_dlm as its locking protocol with lockspace name matching the cluster name specified in mkfs.gfs2 -t <cluster>:<fs>.
Step 7: Cluster LVM (clvmd) and Fencing Devices
Cluster LVM:
📸 Verified Output:
💡 Tip:fence_ipmilan requires the lanplus option for IPMI 2.0 (required for most modern servers with iDRAC/iLO). Test fencing manually before relying on it: fence_ipmilan -a <ip> -l admin -p secret --lanplus -o status. Never configure fencing that you haven't tested!
Step 8: Capstone — Design a Shared Storage Cluster
Scenario: Design a 2-node database cluster using DRBD + GFS2 + Pacemaker with proper fencing for a PostgreSQL HA solution.
cat > /tmp/cluster-storage-blueprint.md << 'EOF'
# Two-Node PostgreSQL HA Cluster Blueprint
## Architecture Decision: DRBD (shared-nothing)
Chosen because:
- No SAN required (cost savings)
- Node-local SSDs for optimal IOPS
- Protocol C ensures zero data loss
- Works in any datacenter/cloud
## Hardware Layout
node1: 10.0.1.11, 32GB RAM, 2x NVMe (OS+Data), IPMI at 10.0.0.11
node2: 10.0.1.12, 32GB RAM, 2x NVMe (OS+Data), IPMI at 10.0.0.12
## Storage Layer: DRBD
- Device: /dev/sdb (500GB NVMe) → /dev/drbd0
- Protocol: C (synchronous)
- Sync rate: 200 MB/s (limited to protect prod workload)
- Filesystem: XFS (PostgreSQL data directory)
## Cluster Layer: Pacemaker + Corosync
Resources (in order):
1. StonithIPMI-node2 (fence_ipmilan)
2. StonithIPMI-node1 (fence_ipmilan)
3. DrbdData (ocf:linbit:drbd) — DRBD promotable clone
4. DrbdDataFS (ocf:heartbeat:Filesystem) — XFS mount
5. ClusterVIP (ocf:heartbeat:IPaddr2) — floating 10.0.1.100
6. PostgreSQL (ocf:heartbeat:pgsql) — database service
## Resource Constraints
- DrbdDataFS REQUIRES DrbdData Primary
- ClusterVIP REQUIRES DrbdDataFS on same node
- PostgreSQL REQUIRES ClusterVIP on same node
- All resources COLOCATED on same node
## Failover Procedure (Automatic)
1. node1 crashes / network partition
2. Corosync detects node1 loss (deadtime ~10s)
3. Pacemaker triggers STONITH: fence_ipmilan powers off node1
4. STONITH confirmed → proceed with failover
5. DRBD promotes node2 to Primary
6. XFS mounts /var/lib/postgresql on node2
7. VIP 10.0.1.100 added to node2
8. PostgreSQL starts on node2
9. Total failover time: ~45-90 seconds
## Monitoring Commands
crm_mon -r # Real-time cluster status
drbdadm status # DRBD sync status
xfs_admin -l /dev/drbd0 # XFS label check
pg_isready -h 10.0.1.100 # PostgreSQL health
EOF
cat /tmp/cluster-storage-blueprint.md
# Two-Node PostgreSQL HA Cluster Blueprint
## Architecture Decision: DRBD (shared-nothing)
Chosen because:
- No SAN required (cost savings)
- Node-local SSDs for optimal IOPS
- Protocol C ensures zero data loss
- Works in any datacenter/cloud
...
# Validate LVM is ready for cluster use
lvm version 2>&1 | head -3
lvmconfig --type default locking 2>&1 | head -10 || lvm config locking_type 2>&1 | head -5
echo "Storage cluster blueprint complete"