How to activate shared volume group outside cluster control that utilizes lvmlockd shared activation
Environment
- Red Hat Enterprise Linux 8, 9
- High Availability Pacemaker Cluster with Resilient Storage Add-on
- GFS2 cluster setup
Issue
- Is it possible to enabled the VG with shared flag outside of cluster?
- Manual activation of shared vg failing.
# vgchange -aey shared_vg1
WARNING: lvmlockd process is not running.
Cannot access VG shared_vg1 due to failed lock.
Resolution
When the cluster is not running (dlm and lvmlockd resources are in stopped state).
Make sure that no hosts has the GFS2 filesystem mounted. If multiple host mount the same GFS2 filesystem at the same time then corruption will occur.
1. Change the VG lock type to none on the host where the VG is started:
# vgchange --lock-type none --lock-opt force shared_vg1
2. Activates the LV in exclusive mode
# vgchange -aey shared_vg1
3. Mount the filesystem.
# mount -t gfs2 -o lockproto=lock_nolock /dev/shared_vg1/shared_lv1 /test/gfs1
Rollback steps:
1. Unmount the filesystem
# umount /test/gfs1
2. Deactivate the volume group
# vgchange -an shared_vg1
3. Start cluster.
# pcs cluster start (--all)
4. Change the VG lock type back to dlm
# vgchange --lock-type dlm shared_vg1
5. Cleanup the resource.
# pcs resource cleanup shared_vg1
In case resources dlm and lvmlockd are in the started state on the node and it is required to activate the shared volume group outside cluster control.
1. Disable the VG resource so that the resource won't start automatically.
# pcs resource disable <resource_id>
2. Start lock manager.
# vgchange --lock-start shared_vg1
3. Activates the LV in exclusive mode
# vgchange -aey shared_vg1
4. Mount the filesystem.
# mount /dev/shared_vg1/shared_lv1 /test/gfs1
Rollback steps:
1. Unmount the filesystem
# umount /test/gfs1
2. Deactivate the volume group
# vgchange -an shared_vg1
3. Stop lock manager.
# vgchange --lock-stop shared_vg1
4. Enable the vg resource so that it can be started under cluster control.
# # pcs resource enable <resource_id>
Root Cause
LVM commands use lvmlockd to coordinate access to shared storage.
When LVM is used on devices shared by multiple hosts, locks will:
- coordinate reading and writing of LVM metadata
- validate caching of LVM metadata
- prevent conflicting activation of logical volumes
lvmlockd uses an external lock manager to perform basic locking.
Lock manager (lock type) options are:
- sanlock: places locks on disk within LVM storage.
- dlm: uses network communication and a cluster manager.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.