You are not logged in.

#1 2014-12-16 13:22:25

starfry
Member
From: Surrey, UK
Registered: 2010-08-18
Posts: 230

[SOLVED]Can I enable boot-time LVM activation of partial volume group?

I have an interesting problem. I have set up my laptop with LUKS and LVM and it works fine.

My laptop has two hard drives in it and I'd like to put both of them into the same LVM volume group. However, when I do this, the existing logical volumes (on the first hard drive) aren't activated because the entire VG isn't online. So, my question asks whether it's possible to direct the LVM early boot (initramfs) to activate complete logical volumes in a partial volume group ?

A little more background about my configuration:

My boot drive is a USB drive attached to my key-ring. Without that, nothing boots.
Grub 2 boots the from USB. It decrypts the first hard drive and sets up the kernel to do the same. This is sufficient to get /root online and, with one drive in the VG, works fine.

Now, if I add the second drive to the VG, the above process stalls as I explained. What I would like to happen is for /root to come online as before. I'll then configure /etc/crypttab to bring the second hard drive online to complete the volume group and allow any remaining logical volumes to activate.

I have added "/usr/bin/vgchange" to the initramfs and this enables me to manually bring the volumes online (vgchange -a y) from the emergency shell and then continue booting successfully. So my config works, if only the volumes would come online as they appear instead of waiting for the whole VG.

Any ideas?

Last edited by starfry (2014-12-17 13:08:19)

Offline

#2 2014-12-16 15:22:33

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,163
Website

Re: [SOLVED]Can I enable boot-time LVM activation of partial volume group?

If I'm not mistaken, there might be a way to do this with multiple LUKS devices with the mkinitcpio-encrypt-multi AUR package. This might shed some light on how to use it.


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#3 2014-12-17 13:08:04

starfry
Member
From: Surrey, UK
Registered: 2010-08-18
Posts: 230

Re: [SOLVED]Can I enable boot-time LVM activation of partial volume group?

Yeah, I saw those but they seem, to me at least, either a little over-complicated or hacky.

I've had a play around with it and have found a very easy way to achieve it - activate the volume in the code that waits for udev. That's in a file called "/usr/lib/initcpio/init_functions".

A simple one-liner that can bring a device on-line is shown below and can be inserted at "/usr/lib/initcpio/init_functions#44"

[ "${device#/dev/mapper/*}" != "${device}" ] && vgchange -a y >/dev/null 2>&1

This just forces an LVM reactivate if the polled device is a device mapper. The redirections are to prevent any standard output, which would otherwise confuse the containing function, and to hide the anticipated warnings output for incomplete volume groups.

However, I produced a more refined version that only activates the requested volume  if it isn't already and only if it's healthy (to avoid any potential problems with volumes not entirely on the physical volume). I've propsed this as an enhancement request with an appropriate patch.

Offline

Board footer

Powered by FluxBB