Show Table of Contents
Chapter 5. Configuring a GFS2 File System in a Cluster
The following procedure is an outline of the steps required to set up a Pacemaker cluster that includes a GFS2 file system.
After installing and starting the cluster software on all nodes, create the cluster. You must configure fencing for the cluster. For information on creating a Pacemaker cluster and configuring fencing for the cluster, see Creating a Red Hat High-Availability Cluster with Pacemaker in High Availability Add-On Administration. Once you have done this, perform the following procedure.
- On all nodes of the cluster, install the
lvm2-clusterandgfs2-utilspackages, which are part of the Resilient Storage channel.#
yum install lvm2-cluster gfs2-utils - Set the global Pacemaker parameter
no_quorum_policytofreeze.Note
By default, the value ofno-quorum-policyis set tostop, indicating that once quorum is lost, all the resources on the remaining partition will immediately be stopped. Typically this default is the safest and most optimal option, but unlike most resources, GFS2 requires quorum to function. When quorum is lost both the applications using the GFS2 mounts and the GFS2 mount itself cannot be correctly stopped. Any attempts to stop these resources without quorum will fail which will ultimately result in the entire cluster being fenced every time quorum is lost.To address this situation, you can set theno-quorum-policy=freezewhen GFS2 is in use. This means that when quorum is lost, the remaining partition will do nothing until quorum is regained.#
pcs property set no-quorum-policy=freeze - Set up a
dlmresource. This is a required dependency forclvmdand GFS2.#
pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=true - Execute the following command in each node of the cluster to enable clustered locking. This command sets the
locking_typeparameter in the/etc/lvm/lvm.conffile to 3.#
/sbin/lvmconf --enable-cluster - Set up
clvmdas a cluster resource.#
pcs resource create clvmd ocf:heartbeat:clvm op monitor interval=30s on-fail=fence clone interleave=true ordered=trueNote that theclvmdandcmirrorddeamons are started and managed by Pacemaker using theocf:heartbeat:clvmresource agent and do not need to be started during boot withsystemd. Additionally, theocf:heartbeat:clvmresource agent, as part of the start procedure, sets thelocking_typeparameter in the/etc/lvm/lvm.conffile to 3 and disables thelvmetaddaemon. - Set up
clvmdanddlmdependency and start up order.clvmdmust start afterdlmand must run on the same node asdlm.#
pcs constraint order start dlm-clone then clvmd-clone#pcs constraint colocation add clvmd-clone with dlm-clone - Create the clustered logical volume.
#
pvcreate /dev/vdb#vgcreate -Ay -cy cluster_vg /dev/vdb#lvcreate -L5G -n cluster_lv cluster_vgWarning
When you create volume groups with CLVM on shared storage, you must ensure that all nodes in the cluster have access to the physical volumes that constitute the volume group. Asymmetric cluster configurations in which some nodes have access to the storage and others do not are not supported.When managing volume groups using CLVMD to allow for concurrent activation of volumes across multiple nodes, the volume groups must have the clustered flag enabled. This flag allows CLVMD to identify the volumes it must manage, which is what enables CLVMD to maintain LVM metadata continuity. Failure to adhere to this configuration renders the configuration unsupported by Red Hat and may result in storage corruption and loss of data. - Format the logical volume with a GFS2 file system. Ensure that you create enough journals for each of the nodes in your cluster.
#
mkfs.gfs2 -j2 -p lock_dlm -t rhel7-demo:gfs2-demo /dev/cluster_vg/cluster_lvWarning
When you create the GFS2 filesystem, it is important to specify a correct value for the-t LockTableNameoption. The correct format is ClusterName:FSName. Failure to specify a correct value will prevent the filesystem from mounting and may cause corruption. For more information on the options for themkfs.gfs2command, see Section 3.1, “Making a File System”. - Configure a
clusterfsresource.You should not add the file system to the/etc/fstabfile because it will be managed as a Pacemaker cluster resource. Mount options can be specified as part of the resource configuration withoptions=options. Run thepcs resource describe Filesystemcommand for full configuration options.This cluster resource creation command specifies thenoatimemount option.#
pcs resource create clusterfs Filesystem device="/dev/cluster_vg/cluster_lv" directory="/var/mountpoint" fstype="gfs2" "options=noatime" op monitor interval=10s on-fail=fence clone interleave=true - Set up GFS2 and
clvmddependency and startup order. GFS2 must start afterclvmdand must run on the same node asclvmd.#
pcs constraint order start clvmd-clone then clusterfs-clone#pcs constraint colocation add clusterfs-clone with clvmd-clone - Verify that GFS2 is mounted as expected.
#
mount |grep /mnt/gfs2-demo/dev/mapper/cluster_vg-cluster_lv on /mnt/gfs2-demo type gfs2 (rw,noatime,seclabel)

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.