Product SiteDocumentation Site

8.2.2. Create and Populate an GFS2 Partition

Now that the cluster stack and integration pieces are running smoothly, we can create an GFS2 partition.

Warning

This will erase all previous content stored on the DRBD device. Ensure you have a copy of any important data.
We need to specify a number of additional parameters when creating a GFS2 partition.
First we must use the -p option to specify that we want to use the the Kernel’s DLM. Next we use -j to indicate that it should reserve enough space for two journals (one per node accessing the filesystem).
Lastly, we use -t to specify the lock table name. The format for this field is clustername:fsname. For the fsname, we need to use the same value as specified in corosync.conf for cluster_name. If you setup corosync with the same cluster name we used in this tutorial, cluster name will be mycluster. If you are unsure what your cluster name is, open up /etc/corosync/corosync.conf, or execute the command pcs cluster corosync pcmk-1 to view the corosync config. The cluster name will be in the totem block.

Important

We must run the next command on whichever node last had /dev/drbd mounted. Otherwise you will receive the message:
/dev/drbd1: Read-only file system
# ssh pcmk-2 -- mkfs.gfs2 -p lock_dlm -j 2 -t mycluster:web /dev/drbd1
This will destroy any data on /dev/drbd1.
It appears to contain: Linux rev 1.0 ext4 filesystem data, UUID=dc45fff3-c47a-4db2-96f7-a8049a323fe4 (extents) (large files) (huge files)
Are you sure you want to proceed? [y/n]y
Device:                    /dev/drbd1
Blocksize:                 4096
Device Size                0.97 GB (253935 blocks)
Filesystem Size:           0.97 GB (253932 blocks)
Journals:                  2
Resource Groups:           4
Locking Protocol:          "lock_dlm"
Lock Table:                "mycluster"
UUID:                      ed293a02-9eee-3fa3-ed1c-435ef1fd0116
# pcs cluster cib dlm_cfg
# pcs -f dlm_cfg resource create dlm ocf:pacemaker:controld op monitor interval=60s
# pcs -f dlm_cfg resource clone dlm clone-max=2 clone-node-max=1
# pcs -f dlm_cfg resource show
 ClusterIP      (ocf::heartbeat:IPaddr2) Started
 WebSite        (ocf::heartbeat:apache) Stopped
 Master/Slave Set: WebDataClone [WebData]
     Masters: [ pcmk-2 ]
     Slaves: [ pcmk-1 ]
 WebFS  (ocf::heartbeat:Filesystem) Stopped
 Clone Set: dlm-clone [dlm]
     Stopped: [ dlm:0 dlm:1 ]
# pcs cluster push cib dlm_cfg
CIB updated
# pcs status

Last updated: Fri Sep 14 12:54:50 2012
Last change: Fri Sep 14 12:54:43 2012 via cibadmin on pcmk-1
Stack: corosync
Current DC: pcmk-1 (1) - partition with quorum
Version: 1.1.8-1.el7-60a19ed12fdb4d5c6a6b6767f52e5391e447fec0
2 Nodes configured, unknown expected votes
7 Resources configured.

Online: [ pcmk-1 pcmk-2 ]

Full list of resources:

 ClusterIP      (ocf::heartbeat:IPaddr2):       Started pcmk-2
 WebSite        (ocf::heartbeat:apache):        Stopped
 Master/Slave Set: WebDataClone [WebData]
     Masters: [ pcmk-2 ]
     Slaves: [ pcmk-1 ]
 WebFS  (ocf::heartbeat:Filesystem):    Stopped
 Clone Set: dlm-clone [dlm]
     Started: [ pcmk-1 pcmk-2 ]
Then (re)populate the new filesystem with data (web pages). For now we’ll create another variation on our home page.
# mount /dev/drbd1 /mnt/
# cat <<-END >/mnt/index.html
<html>
<body>My Test Site - GFS2</body>
</html>
END
# umount /dev/drbd1
# drbdadm verify wwwdata