1

I have CentOS 7, and I want lvm mirrors on my root logical volume.

I had some panic after I used "lvconvert -m3 cl_excalibur/root" to create two mirrors, and it would not boot. The logical volume does not activate at boot when it is raid1. I booted from a liveUSB, and used "lvconvert -m0" to convert it back to un-mirrored, and all seems well. But I'm back to square one. I expect I must use dracut -f --add<-drivers?> <name of the lvm raid kernel module>, but I don't know the exact arguments I need.

During a failed boot, in the dracut lvm tool, I tried lvchange -ay cl_excalibur/root, but lvm complained that the module "dm-raid" was not in the kernel. So that's what I think I need to install.

I found the file /usr/lib/modules/3.10.0-1062.1.1.el7.x86_64/kernel/drivers/md/dm-raid.ko.xz. However, I don't know which add flag to use, nor how to go from the filename above to the argument dracut requires.

This host is important to our infrastructure, so I have not yet tried anything. I've now built a virtual CentOS 7 server so I can hack around with dracut and grub2, but I'll appreciate any help :)

2
  • Did you try no arguments? dracut should automatically detect which modules are needed. Sep 29, 2019 at 6:02
  • "No arguments" dracut -fdid not work, but I used the virtual machine to figure out the solution. See below.
    – Charlweed
    Sep 29, 2019 at 20:13

1 Answer 1

4

It looks like the solution is to edit /etc/dracut.conf, insert some strings into the assignments for add_dracutmodules and add_drivers, and enable the "yes" values for mdadmconf and lvmcomf:

# dracut modules to add to the default
add_dracutmodules+="dm lvm dmraid mdraid"

# additional kernel modules to the default
add_drivers+="dm_mod dm_mirror dm_log dm_region_hash "

# install local /etc/mdadm.conf
mdadmconf="yes"

# install local /etc/lvm/lvm.conf
lvmconf="yes"

The only wacky part is that I needed to include a space after the last kernel driver, and before the closing quote. Otherwise dracut concatenates two driver names into one.

After using lvconvert -m2 on the root logical volume, I waited for the mirroring to complete by checking with lvs -a -o name,copy_percent,devices centos_agamemnon. Then I proceeded with

dracut -f 
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

And rebooted. All seems fine, and I'm less vulnerable to the next, inevitable, hard drive failure.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .