This guide describes DRBD version 8.4 and above. For 8.3 please look here.


6.18. Creating a three-node setup

A three-node setup involves one DRBD device stacked atop another.

6.18.1. Device stacking considerations

The following considerations apply to this type of setup:

  • The stacked device is the active one. Assume you have configured one DRBD device /dev/drbd0, and the stacked device atop it is /dev/drbd10, then /dev/drbd10 will be the device that you mount and use.
  • Device meta data will be stored twice, on the underlying DRBD device and the stacked DRBD device. On the stacked device, you must always use internal meta data. This means that the effectively available storage area on a stacked device is slightly smaller, compared to an unstacked device.
  • To get the stacked upper level device running, the underlying device must be in the primary role.
  • To be able to synchronize the backup node, the stacked device on the active node must be up and in the primary role.

6.18.2. Configuring a stacked resource

In the following example, nodes are named alice, bob, and charlie, with alice and bob forming a two-node cluster, and charlie being the backup node.

resource r0 {
  net {
    protocol C;
  }

  on alice {
    device     /dev/drbd0;
    disk       /dev/sda6;
    address    10.0.0.1:7788;
    meta-disk internal;
  }

  on bob {
    device    /dev/drbd0;
    disk      /dev/sda6;
    address   10.0.0.2:7788;
    meta-disk internal;
  }
}

resource r0-U {
  net {
    protocol A;
  }

  stacked-on-top-of r0 {
    device     /dev/drbd10;
    address    192.168.42.1:7788;
  }

  on charlie {
    device     /dev/drbd10;
    disk       /dev/hda6;
    address    192.168.42.2:7788; # Public IP of the backup node
    meta-disk  internal;
  }
}

As with any drbd.conf configuration file, this must be distributed across all nodes in the cluster — in this case, three nodes. Notice the following extra keyword not found in an unstacked resource configuration:

stacked-on-top-ofThis option informs DRBD that the resource which contains it is a stacked resource. It replaces one of the on sections normally found in any resource configuration. Do not use stacked-on-top-of in an lower-level resource.

[Note]Note

It is not a requirement to use Protocol A for stacked resources. You may select any of DRBD’s replication protocols depending on your application.

6.18.3. Enabling stacked resources

To enable a stacked resource, you first enable its lower-level resource and promote it:

drbdadm up r0
drbdadm primary r0

As with unstacked resources, you must create DRBD meta data on the stacked resources. This is done using the following command:

# drbdadm create-md --stacked r0-U

Then, you may enable the stacked resource:

# drbdadm up --stacked r0-U
# drbdadm primary --stacked r0-U

After this, you may bring up the resource on the backup node, enabling three-node replication:

# drbdadm create-md r0-U
# drbdadm up r0-U

In order to automate stacked resource management, you may integrate stacked resources in your cluster manager configuration. See Section 8.4, “Using stacked DRBD resources in Pacemaker clusters” for information on doing this in a cluster managed by the Pacemaker cluster management framework.


This guide describes DRBD version 8.4 and above. For 8.3 please look here.