LVM over DRBD

Today I try to setup a DRBD mirror using a hard drive partition. My goal is to setup LVM over this DRBD device.

I’m running a Debian Wheezy, but it’s not so important in this case.

All works fine using DRBD documentation, which is very clear to setup this.
Except that I don’t use a logical volume as backing device for DRBD, but a simple disk partition (/dev/sda5 on my setup). And want to create a volume group using the DRBD device.

My problem becomes when I reboot…

In log file /var/log/syslog, I found message:
Dec 22 17:59:50 myhost kernel: [ 8.060773] block drbd0: Starting worker thread (from drbdsetup [2524])
Dec 22 17:59:50 myhost kernel: [ 8.061551] block drbd0: open("/dev/sda5") failed with -16

and DRBD don’t want to start corresponding resource even with command:
# /sbin/drbdadm -- --overwrite-data-of-peer primary r0
0: State change failed: (-2) Need access to UpToDate data
Command '/sbin/drbdsetup 0 primary --overwrite-data-of-peer' terminated with exit code 17

DRBD status:
# drbdsetup 0 status
<resource minor="0" cs="WFConnection" ro1="Secondary" ro2="Unknown" ds1="Diskless" ds2="DUnknown" />

Ok, node2 is off, but Diskless for node1

Nevertheless, my LVM volume is up:
# vgdisplay
--- Volume group ---
VG Name VGDATA
System ID
Format lvm2
...

And LVM physical volume detected is:
# pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name VGDATA
...

But it’s my physical partition /dev/sda5 which is detected instead of my DRBD resource !

LVM start before DRBD, so my device is locked by LVM and may not be used by DRBD at the same time.

After editing /etc/lvm/lvm.conf, and modify filter line to something like:
filter = [ "r|/dev/sda5|", "r|/dev/disk/.*|", "a/.*/" ]

then reboot, all works fine now:

# pvdisplay
--- Physical volume ---
PV Name /dev/drbd0
VG Name VGDATA
...

  • Trackback are closed
  • Comments (0)
  1. No comments yet.

You must be logged in to post a comment.

 

site tracking with Asynchronous Google Analytics plugin for Multisite by WordPress Expert at Web Design Jakarta.