* Home :: Get a random password :: Get a multi-word password :: What is my IP? (v4 | v6)
* My projects

Clustered LVM with lvmlockd and sanlock

Tags: clvm,howto

Date: 20260401

Updated: 20260401


Quick and dirty tutorial on how to setup "CLVM" with lvmlockd and sanlock on EL9, but probably same applies to most/all distros.

Assuming 2 nodes on a shared block storage of sorts (fc, iscsi etc) as /dev/sdb, this is the procedure I would normally follow to get started with the $subject.

On both nodes:

dnf install lvm2-lockd sanlock -y
systemctl enable sanlock --now
systemctl enable lvmlockd --now

edit /etc/lvm/lvm.conf # make sure in the "global" section you have "use_lvmlockd = 1"
edit /etc/lvm/lvmlocal.conf # make sure in the "local" section you have a valid entry as the following, it needs to be a unique number per host: "host_id = 1" on node1 and "host_id = 2" on node2

        

Just on one/first node initialize the shared disk /dev/sdb and start the VG in shared mode:

pvcreate /dev/sdb
vgcreate --shared --lock-type sanlock sharedvg /dev/sdb
        

On the second node do:

lvmdevices --adddev /dev/sdb # adds the disk to /etc/lvm/devices/system.devices
vgchange --lockstart sharedvg # starts the VG in shared mode
        

That's it, you can now start playing with creating LVs, locking them, sharing them etc.


(c)The Nux(tm) ;-)

No CSS, no Javascript, no some HTML.
No ads, no tracking, no cookies, no AI.


Optimised for Dillo browser, great in Lynx, too :)