Ubuntu DRBD – DRBD with External Meta Disk

drbdUbuntu

I am attempting to create a failover with DRBD and I have two partitions.

Partition 1) /dev/sda4 is setup for the KVMs I will be creating.
Partition 2) /dev/sda5 is for the DRBD metadata

My config file is below

resource r0 {
    protocol C;
    startup {
            wfc-timeout  15;
            degr-wfc-timeout 60;
    }
    net {
            cram-hmac-alg sha1;
            shared-secret "SECRET_KEY";
    }
    on Server1{
            device /dev/drbd0;
            disk /dev/sda4;
            address IP:7788;
            meta-disk /dev/sda5;
    }
    on Server2{
            device /dev/drbd0;
            disk /dev/sda4;
            address IP:7788;
            meta-disk /dev/sda5;
    }

}

When I run drbdadm create-md r0 it runs successfully but it creates /dev/drbd0 on both partitions.

    ├─sda4      8:4    0  7.2T  0 part
    │ └─drbd0 147:0    0  7.2T  1 disk
    └─sda5      8:5    0  399M  0 part
      └─drbd0 147:0    0  7.2T  1 disk

It's my understanding that it should only create it on the meta disk which is /dev/sda5. The reason I setup the meta disk is to avoid any writing to sda4. Am I correct in that reasoning or am I missing something.

Best Answer

Finally figured this out. By putting the volume group on top of DRBD0 everything is now working.

I did run into a problem when creating a volume group on the device and had to add filter to lvm.conf

I got an error that said

Cannot use device /dev/drbd/ with duplicates

I just added the this to the devices section

filter = [ "r|/dev/sda4|", "r|/dev/disk/|", "r|/dev/block/|", "a/.*/" ]

Everything works great now