Hi all,
I've been working on setting up my MSA2040 (SAS) to be available in more then just sharing a raw LVM due to the fact that offering a raw lvm only supports diskimages and containers.
The idea was to also have (shared) storage (directory)presented to pve for backup/snippets/templates ( all which is unavailable when using a raw lvl basically)
So i set out on this journey and started out reading about shared LVM ... first stuff coming into view was 'clvm' .. however that package seems unavailable on Debian Buster and was replaced by lvmlockd.
Up untill now i have devised the following approach, but with ToDo points before i can implement this in a production env :
What is needed to be installed (ON ALL NODES !):
Create a /etc/dlm/dlm.conf with content :
Then :
If all is well create a shared LVM on your storage :
Start the lock for this VG on all nodes
recheck "dlm_tool ls" , a lockspace should've been added
Create a Logical Volume in the share VG the regular way:
Activate the LV with a shared lock: (needs to be done on all nodes)
Create a filesystem on it (only once on one node) , the -j option specifies the journals ( one for each node, in my case 4)
Mount the LV somewhere ( all nodes)
Do some testing with writing data to it, and verify you can see it on other nodes.
A simple touch <filename> will do
ToDo list :
Regarding the ToDo list, if anyone has input it is greatly appreciated, cause atm i'm feeling like i am (re-)inventing the wheel here.
Glowsome
I've been working on setting up my MSA2040 (SAS) to be available in more then just sharing a raw LVM due to the fact that offering a raw lvm only supports diskimages and containers.
The idea was to also have (shared) storage (directory)presented to pve for backup/snippets/templates ( all which is unavailable when using a raw lvl basically)
So i set out on this journey and started out reading about shared LVM ... first stuff coming into view was 'clvm' .. however that package seems unavailable on Debian Buster and was replaced by lvmlockd.
Up untill now i have devised the following approach, but with ToDo points before i can implement this in a production env :
What is needed to be installed (ON ALL NODES !):
- lvmlockd (package lvm2-lockd) - this will add option in /etc/lvm/lvm.conf : use_lvmlockd = 1
- dlm ( package dlm-controld)
- gfs2 (package gfs2-utils) => i used gfs filesystem on the shared LV
Create a /etc/dlm/dlm.conf with content :
Code:
# Enable debugging
log_debug=1
# Use tcp as protocol
protocol=tcp
# Delay at join
post_join_delay=10
# Disable fencing (for now)
enable_fencing=0
Then :
- Start lvmlockd on all nodes ( systemctl start lvmlockd) and let it come up (i waited ~20 seconds before continueing ( see To-Do list)
- Start dlm on all nodes (systemctl start dlm)
If all is well create a shared LVM on your storage :
- pvcreate /dev/sdX
- vgcreate --shared vgname /dev/sdX
Code:
VG #PV #LV #SN Attr VSize VFree
cluster01 1 42 0 wz--n- <7.09t <5.16t
cluster02 1 1 0 wz--ns 2.00t 0
^-----Shared
Start the lock for this VG on all nodes
Code:
vgchange --lock-start
recheck "dlm_tool ls" , a lockspace should've been added
Create a Logical Volume in the share VG the regular way:
Code:
lvcreate -n lvname -l 100%FREE vgname
Activate the LV with a shared lock: (needs to be done on all nodes)
Code:
lvchange -asy /dev/vgname/lvname
Create a filesystem on it (only once on one node) , the -j option specifies the journals ( one for each node, in my case 4)
Code:
mkfs.gfs2 -t <YOUR CLUSTERNAME>:backups -j 4 -J 64 /dev/vgname/lvname
Mount the LV somewhere ( all nodes)
Code:
mount -t gfs2 /dev/vgname/lvname /your/mountpoint
Do some testing with writing data to it, and verify you can see it on other nodes.
A simple touch <filename> will do
ToDo list :
- when i reboot a node and comes up it seems that lvmlockd isnt fully up when dlm starts resulting in global lockspace is not obtained, killing both lvmlockd and dlm_controld and restarting them with like 20 sec apart seems to solve this => Timing issue ?
- automate the activation of the shared VG and shared LV on all nodes
Regarding the ToDo list, if anyone has input it is greatly appreciated, cause atm i'm feeling like i am (re-)inventing the wheel here.
Glowsome