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

Lars Ellenberg lars.ellenberg at linbit.com
Mon Jan 14 17:47:55 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.


On Mon, Jan 14, 2008 at 05:29:01PM +0100, Tomasz Chmielewski wrote:
> 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.

after a couple of seconds of contemplating I got to the point where I
have to conclude that this would mean that a non-negligible number of
our managed production deployments are impossible, there for non
existent.  I wonder why I hear no customer complaints, though.
 ;)

> 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:

as pointed out earlier, you have to fix your lvm conf, specifically the
filter setting.  if you don't, it won't work.

> # 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.

you did hear about udev and scsi id, did you?

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

you make your device nodes persistent.
how to do that is detailed in depth elsewhere.
this problem generic, and not specific to drbd at all.

you configure proper filters in lvm.conf.

you configure the heartbeat resources properly.

all set.

-- 
: Lars Ellenberg                           http://www.linbit.com :
: DRBD/HA support and consulting             sales at linbit.com :
: LINBIT Information Technologies GmbH      Tel +43-1-8178292-0  :
: Vivenotgasse 48, A-1120 Vienna/Europe     Fax +43-1-8178292-82 :
__
please use the "List-Reply" function of your email client.



More information about the drbd-user mailing list