[DRBD-user] drbd and LVM -> always getting duplicate volumes (was: can't use LVM2 on drbd devices)

Tomasz Chmielewski mangoo at wpkg.org
Mon Jan 14 17:29:01 CET 2008

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


After a couple of days of struggling I got to the point where I have to 
conclude that using LVM reliably over DRBD devices is impossible.

As there are many users using LVM on DRBD, I would like to be corrected, 
of course.

Below, a step-by-step configuration of DRBD and LVM:


1. A relevant part of drbd.conf - our drbd0 device is on /dev/sda:

     on san2 {
         device    /dev/drbd0;
         disk      /dev/sdb;
         address   192.168.111.158:7789;
         meta-disk internal;
     }


2. Create drbd0 meta data:

# drbdadm create-md r0


3. Start DRBD:

# /etc/init.d/drbd start


4. Initial device sync:

# drbdadm -- --overwrite-data-of-peer primary all


5. Now, we should be able to create LVM - pvcreate first:

# pvcreate /dev/drbd0
   Physical volume "/dev/drbd0" successfully created


6. Let's create a volume group - Houston, we have a problem!

# vgcreate testvolume /dev/drbd0
   Found duplicate PV YIoJ98OFL3vhqhi7ek98UWkT7aBIzgrz: using /dev/sdb 
not /dev/drbd0
   Found duplicate PV YIoJ98OFL3vhqhi7ek98UWkT7aBIzgrz: using /dev/drbd0 
not /dev/sdb
   Found duplicate PV YIoJ98OFL3vhqhi7ek98UWkT7aBIzgrz: using /dev/sdb 
not /dev/drbd0
   Found duplicate PV YIoJ98OFL3vhqhi7ek98UWkT7aBIzgrz: using /dev/drbd0 
not /dev/sdb
   Volume group "testvolume" successfully created


7. pvs confirms it - LVM sits on /dev/sdb, not on /dev/drbd0 - 
certainly, nothing will be replicated by DRBD:

# pvs
   Found duplicate PV YIoJ98OFL3vhqhi7ek98UWkT7aBIzgrz: using /dev/sdb 
not /dev/drbd0
   PV         VG         Fmt  Attr PSize   PFree
   /dev/sdb   testvolume lvm2 a-   558.57G 558.57G



As device names are not necessarily persistent (if /dev/sdb is a iSCSI 
drive, next time one boots it can be /dev/sdc) and a similar is for 
device mapper devices (think of crypted devices), setting up filters in 
lvm.conf will not be reliable.

How can I use LVM over DRBD devices *reliably*?



-- 
Tomasz Chmielewski
http://wpkg.org



More information about the drbd-user mailing list