How to mount Device Mapper volume at boot or shortly after?
I have a slow LVM Integrity RAID volume that I want to apply Writecache to (Data drive for VM and NAS storage).
With current LVM rules I can do this a couple of ways:
#1 - Manually edit DM table metadata config to add writecaching to the integrity RAID
- this is a little messy but allows mount at boot like any other LVM volume and bypasses the rules manually
- https://github.com/lvmteam/lvm2/issues/92#issuecomment-1281315510
#2 - Use dmsetup to add the writecache volume onto the existing Integrity RAID volume (command below)
- this is what LVM would normally do for me but its rules tell it not to (devs say it just needs more testing)
- I believe this requires initram config to mount at boot but this is new to me
Either approach gets me the performance figures that I want.
What would I need to do to get method #2 to mount automatically at boot?
Here are the commands I'm using below to create the writecache config and mount it manually:
# Create a writecache device mapper virtual node called 10TB_hybridmirror with a 4K blocksize:
dmsetup create 10TB_hybridmirror --table "0 19376463872 writecache s /dev/writecache_vg/10TB_mirror_lv /dev/writecache_vg/100GB_writecachemirror_lv 4096 0"
Definitions:
- Volume Group: writecache_vg
- Slow Integrity RAID 7K HDD Volume: 10TB_mirror_lv
- Fast Integrity RAID NVMe Cache Volume: 100GB_writecachemirror_lv
- Resulting Device Mapper Node: 10TB_hybridmirror
Current Environment is Alma Linux 9. Alma, Rocky and Oracle Linux are the distros I have been testing on.
Thanks for your help!
[Visuals below of planned architecture]
Posted Nov 23, 2022, 2:52 AM UTC · edited
try getting the uuid. Look up some fstab examples and add an entry for your volume uuid and the mount point. i dont see why this wouldn't work
I've been having trouble locating a UUID for this node. It's strange.
If I run dmsetup info --columns I can see a UUID for every other LVM LV but not for this manually created Device Mapper node.
Maybe more is required than just creating the node with dmsetup before it gets a UUID?
Learning lots of new things right now and likely I've missed something simple...
try using this command: blkid
u can also use lvdisplay to see ur uuid
you should see partuuid of each device if you are having trouble locating uuid u can skip it for now and try to do it that way later, using uuid is the best practice for many reasons however you can still use the device name ( its usually discouraged to use the device mapping name since it might change after a reboot) just find another fstab example and try that
I think there is still more missing here as the device mapper node does not exist after reboot and the dmsetup command has to be run again to create it. Any thoughts on that piece?
not really but i did edit my comment above try getting the uuid using those 2 commands.im not sure as i create my logical volumes using different method