Howtos - Data Redundancy with DRBD
[edit] Overview
This howto is a short installation guide for DRBD. We will go through an example of configuring a two-server backup for a /home directory. This solution creates a "live backup" of your /home directory. If you need to add automatic failover, then follow the instructions in the Heartbeat Howto. Without the Heartbeat software, you have to use your your system administrator skills to access data on the backup server.
[edit] Preparation
The hard disk partitions on the two example servers must be setup with care. On both of your servers, you need one partition at least 128MB in size for the DRBD software, and one /home partition. The /home directories on the two servers should be of equal size. In our example, our partitions are:
/dev/hda1 -- 133 MB /boot
/dev/hda2 -- 10000 MB (for /home)
/dev/hda3 -- 5000 MB /
/dev/hda5 -- 512 MB swap
/dev/hda6 -- 133 MB (for /drbd)
 |
Warning! |
 |
| |
 |
|
Make sure the DRBD partition is at least 128MB. The disk partitioning tool may round your requested size down a couple of megabytes.
|
|
[edit] Installation
After installing your ClarkConnect system, you will need to install the DRBD software. In version 4.1, you can install the software with the following commands:
apt-get update
apt-get install drbd-kernel
Note: you must match the drbd-kernel version to your installed kernel version. The apt-get command will show you a list of available versions.
[edit] Configuration
First, you need to make sure the DRBD kernel module is loaded. This will be done automatically when you are done, but for now you should run modprobe drbd'.
You then need to create a /etc/drbd.conf configuration file for your setup. There is a basic sample configuration file (drbd.conf.sample) in the /usr/share/doc/drbd-version directory to get you started.
resource r0 {
protocol C;
incon-degr-cmd "halt -f";
on server1.lan { # ** EDIT ** the hostname of server 1
device /dev/drbd0; #
disk /dev/hda2; # ** EDIT ** data partition on server 1
address 192.168.2.90:7788; # ** EDIT ** IP address on server 1
meta-disk /dev/hda6[0]; # ** EDIT ** 128MB partition for DRBD on server 1
}
on server2.lan { # ** EDIT ** the hostname of server 2
device /dev/drbd0; #
disk /dev/hda2; # ** EDIT ** data partition on server 2
address 192.168.2.91:7788; # ** EDIT ** IP address on server 2
meta-disk /dev/hda6[0]; # ** EDIT ** 128MB partition for DRBD on server 2
}
}
Copy the sample file to /etc/drbd.conf and change the hostnames, IP addresses and disk.
 |
Warning! |
 |
| |
 |
|
If you have the /home or /drbd partitions mounted, then unmount them and remove them from your /etc/fstab file |
|
Now is a good time to go to the DRBD Quick start guide. When your done, you should have your DRBD system up and running!
[edit] Finishing Up
- Enable drbd at boot time -- run /sbin/chkconfig drbd on on the command line
- Make sure you are not mounting the two hard disk partitions used by the DRBD system (one partition for data, the other for DRBD's meta data).
- You need to mount/unmount the DRBD share. In our example, run mount /dev/drbd0 /home
|