Wednesday, March 28, 2012

ProxmoxVE 2: Configuring DRBD

I am running ProxmoxVE 2.0-35/d07f49c3 on two nodes connected using a cross cable on gigabit nics.
host1 ip:
host2 ip:

Check if drbd module is available
modprobe -l | grep drbd
Check if drbd module is loaded
lsmod | grep drbd
If not, load it with
modprobe -v drbd
Check the module version
modinfo drbd | grep version
I installed the appropriate drbd8-utils package on both nodes
dpkg -i drbd8-utils_8.3.10-0_amd64.deb
I built my own deb from source. You can find my build here.

I shrank the data volume on both of
I made use of the extents I freed up by shrinking the data volume to create an lvm volume that will be used for drbd.
lvcreate --verbose --extents 50000 --name lv4drbd pve
Next I modified /etc/drbd.d/global_common.conf so that it only contains:
global {
    usage-count no;
common {
    protocol C;
    syncer {
        rate 30M; 
Next I created a new resouce file /etc/drbd.d/drbd0.res
resource drbd0 {
    protocol C;
    startup {
        wfc-timeout  0;
        degr-wfc-timeout 60;
        become-primary-on both;
    net {
        cram-hmac-alg sha1;
        shared-secret "drbd0-secret";
        after-sb-0pri discard-zero-changes;
        after-sb-1pri discard-secondary;
        after-sb-2pri disconnect;
    on host1 {
        device /dev/drbd0;
        disk /dev/pve/lv4drbd;
        meta-disk internal;
    on host2 {
        device /dev/drbd0;
        disk /dev/pve/lv4drbd;
        meta-disk internal;
I added the IP address of the other host into each of the /etc/hosts files.

Next I started drbd on both nodes with
/etc/init.d/drbd start
I then initialized drbd metatdata on both nodes with
drbdadm create-md drbd0
Next I brought up the device on both nodes with
drbdadm up drbd0
I checked the status on both nodes with
Next I started synchronization(should be instantaneous) from one node with
drbdadm -- --clear-bitmap new-current-uuid drbd0
Lastly, I restarted the drbd service on both nodes to enable Primary/Primary operation
/etc/init.d/drbd stop
/etc/init.d/drbd start

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

No comments:

Post a Comment