[arch-dev-public] Automatic LVM assembly - call for testers

Thomas Bächler thomas at archlinux.org
Sat Mar 6 15:08:43 CET 2010

Traditionally, LVM is assembled by running "vgchange -ay" manually. That
has several problems, especially if one of the physical volumes is
missing when the VG was supposed to be assembled. This has been
experienced by people who use LVM on USB storage for their root device.

I came up with a way of assembling LVM automatically through udev: A
udev rule combined with a short shell script waits until all required
physical volumes have been detected, then assembles the volume group in
the background. This also works when adding a removable device to the
system at any time.

I'm asking anyone with LVM and a bit of spare time to test this. I'm
especially interested in results from people who have a volume group on
more than one hard drive.

This is how it works: Get the package from:
If you want to use this for detection of your boot device: Replace the
"lvm2" hook with the "lvm_autoassemble" hook in mkinitcpio.conf and
recreate the initramfs (make sure to keep a copy of the working one, as

Possible side-effects: There may be some trouble when dealing with
removable devices that contain LVM physical volumes: The volume groups
are automatically activated, but have to be deactivated manually before
removing the drive. Furthermore, when you remove a device and add it
again later, the mechanism that detects whether all PVs have been found
might fail and "vgchange -ay" may be run too often.

Another side-effect is that I didn't add --ignoremonitoring to the
script, so dmeventd may be started in initramfs (for mirror or snapshot
volumes), which may not be desired.

Any feedback is welcome.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-dev-public/attachments/20100306/9cde2cdd/attachment.bin>

More information about the arch-dev-public mailing list