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 /dev/drbd/by-res/resource
  Physical volume "/dev/drbdnum" successfully created
vgcreate vg-name /dev/drbd/by-res/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

Or, for a GFS2 filesystem:

mkfs -t gfs2 -p lock_dlm -j 2 -t cluster:name /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 GFS cluster; since DRBD does not support more than two nodes, the value to set here is always 2.

The -t option, applicable only for GFS2 filesystems, defines the lock table name. This follows the format cluster:name, where cluster must match your cluster name as defined in /etc/cluster/cluster.conf. Thus, only members of that cluster will be permitted to use the filesystem. By contrast, name is an arbitrary file system name unique in the cluster.