I'm currently trying to simulate the environment via XEN. I have installed two debian systems with such FS layout:

cltest1:/etc# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda2            6.0G  417M  5.2G   8% /
tmpfs                 257M     0  257M   0% /lib/init/rw
udev                   10M   16K   10M   1% /dev
tmpfs                 257M  4.0K  257M   1% /dev/shm

Host cltest2 is identical.

Here's my drbd.conf

global {
  minor-count 1;

resource mysql {
  protocol C;

  syncer {
    rate 10M; # 10 Megabytes

  on cltest1 {
    device    /dev/drbd0;
    disk      /dev/xvda2;
    meta-disk internal;

  on cltest2 {
    device    /dev/drbd0;
    disk      /dev/xvda2;
    meta-disk internal;

I have not created filesystem on drbd0

Starting DRBD via init.d script errors out with:

Starting DRBD resources:    [ d(mysql) /dev/drbd0: Failure: (114) Lower device is already claimed. This usually means it is mounted.

[mysql] cmd /sbin/drbdsetup /dev/drbd0 disk /dev/xvda2 /dev/xvda2 internal --set-defaults --create-device  failed - continuing!

Running: drbdadm create-md mysql gives:

cltest1:/etc# drbdadm create-md mysql
md_offset 6442446848
al_offset 6442414080
bm_offset 6442217472

Found ext3 filesystem which uses 6291456 kB
current configuration leaves usable 6291228 kB

Device size would be truncated, which
would corrupt data and result in
'access beyond end of device' errors.
You need to either
   * use external meta data (recommended)
   * shrink that filesystem first
   * zero out the device (destroy the filesystem)
Operation refused.

Command 'drbdmeta /dev/drbd0 v08 /dev/xvda2 internal create-md' terminated with exit code 40
drbdadm aborting

As I understand, all of my problems are because I don't have unallocated disk space on xvda2.

What are my options besides shrinking FS and connecting a separate physical disk? Can't the meta-data be stored on a file in the local filesystem?

  • 8
    You're trying to do DRBD on your root file system. Don't.
    – womble
    Jun 17, 2009 at 11:22
  • Why not? (bypassing character limit)
    – Karolis T.
    Jun 17, 2009 at 12:14
  • 1
    How are you planning on booting a machine that you can't read the root filesystem of?
    – womble
    Jun 17, 2009 at 12:18
  • 1
    I wasn't aware that DRBD needs a separate partition. Somehow got the impression that it's all done in userspace on top of an existing partition.
    – Karolis T.
    Jun 17, 2009 at 12:50
  • 1
    Uhm, no, DRBD is done mostly in-kernel. You no longer have access to the original block device, instead accessing the shared block device using /dev/drbdN.
    – womble
    Jun 17, 2009 at 13:19

4 Answers 4


drbd can sometimes pickup 'existing' filesystems even without one being on the sytem. You could of dd if=/dev/zero of=/dev/xvda2 (and control-C after a few secs) and it will clear the partition that could of held a filesystem before.

  • 1
    You can also use the bs option to set a block size and count option to specify how many blocks to write. This way you don't have to fire the canon only to SIGINT later.
    – Scott Pack
    Nov 30, 2012 at 2:41

You are not suppose to mount the disk with any filesystem format; In Ubuntu, using gparted I specified the /dev/xvda2 to "Cleared" partition. and running the same command removes the above error.


1) Take note of womble's comment
2) Options for DRBD Metadata (All must be block devices AFAIK)
   A) Internal - good for a device that has never been used (not your situation)
   B) "External" - A seperate partition / drive, this could also be a Ramdisk but your metadata will disappear between power cycles

So You Can
A) Rebuild the system with different partitions and use drbd from the start on the data partitions
B) Use a Ramdisk that disappears between reboot
C) Add a drive(USB, eSATA, internal, etc) for metatdata.

Good Luck - DRBD is a good thing.

  • 2
    Don't put your metadata on a RAM disk. This means you're up for a complete rebuild every time you reboot.
    – womble
    Jun 17, 2009 at 12:02
  • Thanks Jeff, I think that adding a separate partitioned drive is my only option so far.
    – Karolis T.
    Jun 17, 2009 at 12:15

I dont' grab what you are trying to do. cltest1 and cltest2 will never run concurrent?

Why do you want to mirror the root-filesystems between those two systems?

Do you run cltest1 and cltest2 on the same hardware?

For the drbd-meta-device: put it on it's own LV. On that LV use indexing. e.g.

meta-disk /dev/VG/drbd_meta [1]; The next drbd can use index 2 on the same LV. That way you could use an LV with 1 GB for many DRBD-devices.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .