Creating a GFS filesystem

In order to create a GFS filesystem on your dual-primary DRBD resource, you must first initialize it as a Logical Volume for LVM.

Contrary to conventional, non-cluster-aware LVM configurations, the following steps must be completed on only one node due to the cluster-aware nature of CLVM:

pvcreate $(drbdadm sh-dev resource)
  Physical volume "/dev/drbdnum" successfully created
vgcreate vg-name $(drbdadm sh-dev resource)
  Volume group "vg-name" successfully created
lvcreate --size size --name lv-name vg-name
  Logical volume "lv-name" created

CLVM will immediately notify the peer node of these changes; issuing lvs (or lvdisplay) on the peer node will list the newly created logical volume.

Now, you may proceed by creating the actual filesystem:

mkfs -t gfs -p lock_dlm -j 2 /dev/vg-name/lv-name

The -j option in this command refers to the number of journals to keep for GFS. This must be identical to the number of nodes in the cluster; since DRBD does not support more than two nodes, the value to set here is always 2.