3. Using drbdsetup

3.1. drbdsetup

drbsetup is the low level configuration tool of the drbd program suite. You can use it to associate drbd devices with lower level block devices, set up drbd device pairs to mirror their low level block devices, and inspect configurations of running drbd devices.

3.2. Example of using drbdsetup

Let's assume that your two machines are named node1 (10.0.0.10) and node2 (10.0.0.20), and you want to use /dev/hdc6 as the lower level block device on both machines. On node2, you would issue the following commands:

$ insmod drbd.o
$ drbdsetup /dev/nb0 disk /dev/hdc6
$ drbdsetup /dev/nb0 net 10.0.0.20 10.0.0.10 B

On node1 you would issue the following commands:

$ insmod drbd.o
$ drbdsetup /dev/nb0 disk /dev/hdc6
$ drbdsetup /dev/nb0 net 10.0.0.10 10.0.0.20 B
$ drbdsetup /dev/nb0 primary

At this point, you can use the /dev/nb0 just like any other device

$ mkfs -b 4096 /dev/nb0
$ mount /dev/nb0 /mnt/mountpoint

In the example above, the "B" protocol is used. drbd allows you to select the protocol which controls how data is written to the secondary device.

Table 1. DRBD Protocols

ProtocolDescription
AA write operation is complete as soon as the data is written to disk and sent to the network.
BA write operation is complete as soon as a reception acknowledgement arrives.
CA write operation is complete as soon as a write acknowledgement arrives.

There are also additional paramaters you can pass to the disk and net options. See the drbdsetup man page for additional information