WWW.PRL.DK
Linux and FreeBSD fun. > DRBD + HA > Basic DRBD setup

Basic DRBD setup


Example configuration file. ( /etc/drbd.conf )

-----
resource "bd0" {
protocol C;
incon-degr-cmd "echo '!DRBD! pri on incon-degr' | wall ; sleep 60 ; halt -f";
startup { wfc-timeout 0; degr-wfc-timeout 120; }
disk { on-io-error detach; }
syncer {
rate 10M;
group 1;
}
on cluster1 {
device /dev/drbd0;
disk /dev/sda5;
address 192.168.50.10:7792;
meta-disk internal;
}
on cluster2 {
device /dev/drbd0;
disk /dev/sda5;
address 192.168.50.11:7792;
meta-disk internal;
}
}
-----

Make partition for your DRBD filesystem on each machine.

cat /proc/partitions

Check that the device are present, if not run partprobe.

drbdadm -- --do-what-I-say primary bd0

Then make a filesystem at the device.( mke2fs -j /dev/drbd0 )

You can use the command drbdadm to administrate your new filesystem. Here's a litle and uncompleted overview of how to use it.

You can choose to target a single filesystem, do that when you got more than one.

drbdadm primary bd0 -- Set's bd0 as primary on the local machine.

drbdadm state bd0 -- Status on bd0.

drbdadm state all -- Status om all DRBD filesystems.

drbdadm cstate all -- Connection status


Find more options by running drbdadm without extensions.


-----

READ THIS : If you shut down a machine for maintenance, then set ALL filesystems to primary on the one still running BEFORE the shutdown. This should happen automagical if you are using Heartbeat (HA).

UNCLEAN SHUTDOWN : If both machines have been shut down unclean at the same time. Then start up one machine first, set all filesystems as primary. Then start the other machine and CHECK that all filesystems are consistent. ( cat /proc/drbd ).