This web page is no longer maintained. Information presented here exists only to avoid breaking historical links.The Project stays maintained, and lives on: see the Linux-HA Reference Documentation.To get rid of this notice, you may want to browse the old wiki instead.

Along with the DRBD tarball or your installed DRBD package, you should find a well commented example configuration file. In the tarball this is in ./scripts/drbd.conf, in installed binary packages it most likely ends up somehwere in /usr/{shared/,}doc/packages/drbd.

You edit that to your needs, copy it to /etc/drbd.conf on both nodes, and check that the meta-disk points to the right location.

If you are setting up multiple resources, make sure that your /etc/drbd.conf file uses different ports (or different IPs) for each resource.

Caution

Double check, because if the next step will not find any valid DRBD meta data block where it expects it to be, it will create a new one. If you pointed it to the wrong place, it will overwrite a few KB to several MB of possibly valuable data!

If you want to use meta-disk = internal;, make sure you shrink an existing file system first!.

Currently DRBD meta-data reserves 128MB, regardless of actual physical data storage. This allows for a maximum storage size of a single DRBD device of approximatly 4TB.

Ok, now, we have that drbd.conf, copy it to /etc/drbd.conf of both nodes. Then, on both nodes, do a drbdadm up all. It should come up as both nodes Secondary and Inconsistent.

The latter is because the underlying storage is not yet in-sync, and DRBD has no way to know whether you want the initial sync from left-to-right, or right-to-left. So you have to tell it. If you have no data below it, it does not matter. But if you have an existing filesystem on the lower level device, and now you sync in the wrong direction, you'd need to get your latest backup ready afterwards...

You choose which node shall become Primary for the first time (the one with the good data, if you have some), then you do drbdadm -- --do-what-I-say primary all (and you better be sure you mean what you say). The result is a full sync of the underlying devices (initial full sync).

The device is usable right away, so if you have no file system already, you should create one now.

You now mount the DRBD on the current Primary, edit some files, unmount it, make that node Secondary, the other one Primary, mount the DRBD there, and see your edits have been mirrored.

Thats it, now you integrate it with heartbeat.

Happy DRBDing.

Again, on the command line

This example already uses /dev/drbdX instead of /dev/nbX, what you might have expected. For historical reasons DRBD used to hijack NBDs device major (43), and device nodes. We now have an officially assigned DRBD major (147), therefore starting with 0.7.1 we default to use our own major numbers and device nodes. (Unfortunately the assignment was a few days late for 0.7.0; so your distribution may have decided to stay with the deprecated /dev/nbX # major 43)

If your system does not know about /dev/drbdX yet, you should create these device nodes like for i in $(seq 0 15) ; do mknod /dev/drbd$i b 147 $i ; done. See also the upgrade*.txt files, mentioned earlier.

Well, actually this will cause the configured "incon-degr-cmd" to be executed by drbdadm. Since in the example configuration this include a "halt -f", you asked for that reboot. So until you have a running setup, you should probably configure something less brutal, maybe rather configure in your drbd.conf