Comment 2 for bug 246324

Revision history for this message
Maxim Doucet (maximdoucet) wrote :

I also encounter this problem in the same configuration: LVM on top of DRBD.

Here's the setup:
 * a DRBD device is created from a standard partition (ie. /dev/sda6). The drbd device is named /dev/drbd0
 * /dev/drbd0 is a LVM's PV (Physical Volume): pvcreate /dev/drbd0
 * this DRBD's Physical Volume contains a LVM Volume Group (VG) which itself contains several LVM Logical Volumes (ie. /dev/mapper/vgstor-lv1)

Because /dev/drbd0 is a device based on /dev/sda6, we have to make sure that LVM does not use /dev/sda6 when it gets initalized. In other words, /dev/drbd0 must be the device to use for LVM's initialization. This is done thanks to a filter in /etc/lvm/lvm.conf which rejects all devices but DRBD ones. Here's the LVM rule inside /etc/lvm/lvm.conf:

    filter = [ "a|/dev/drbd.*|", "r|.*|" ]

Now indeed everything works fine... until the next boot.

Here's the problem on next boot: as described in the bug, the initramfs-tools hookscript doesn't include for /etc/lvm/lvm.conf. The consequence is that all devices are scanned for LVM tags, in order to create Logical Volumes devices in /dev/mapper/.

In my exemple, because /dev/sda6 is not filtered during initramfs's boot, the Logical Volume /dev/mapper/vgstor-lv1 is created. Now, /etc/init.d/drbd is launched later in the boot sequence. It tries to use /dev/sda6 to create /dev/drbd0 but it fails saying:

     /dev/drbd0: Failure: (114) Lower device is already claimed. This usually means it is mounted.

A dirty workaround is to delete the LVM device with:
    dmsetup remove /dev/mapper/vgstor-lv1

... then to launch DRBD.

The good fix is of course to take care to include /etc/lvm/lvm.conf with the initramfs-tools hookscript just as described in the bug.

Problem encountered on a default Ubuntu 8.10 Server edition.