In this section I’ll cover setting up DRBD via LCMC. This section can be used by itself to create a linux block replica for let’s say an NFS volume to share among linux/unix systems. As I wrote before, my motivation was to setup separate modules and engineer a system for a SAN. Before you setup, you’ll want to allocate either a drive or a partition to be used for DRBD. You can’t deploy DRBD (I believe) on an existing partition since DRBD stands for Distributed Replicated Block Device. You’re creating a system which replicates at the block level. You’ll see later that you will be asked how to format the new Block Device. In the picture above you will first notice that both nodes drbd1 and drbd2 are shown in the main window. You would select “Storage (DRBD, LVM) from the left menu item to bring you into the section to create a DRBD block device.
Perform the following steps…
1) You would then right-click the device/partition set aside for DRBD (in my case /dev/sdb1).
2) Select “Add Mirrored Disk”.
3) Select the Cluster Node to be used for the mirror.
4) Select the device/partition on the other node to use as it’s mirror/partner. In the above picture I used /dev/sdb1 on drbd2. You will then be prompted which network interface will be used to sync up the block devices. You’ll want to make sure it’s a separate interface and not part of the local lan used by the computer. If you suffer a node failure, drbd repair may/will max out the connection to rebuild the block mirror. I left the default name for the drbd resource name (r0) and the sync protocol to Synchronous. Note that the resource name r0 is the identifier used by DRBD, it’s not the linux device name. That’s in the next section. In the next window you will be prompted for a “Device” name for the DRBD block device being configured. I used the default “/dev/drbd0” Next you will be prompted for where to locate the DRBD Meta Data in both node 1 and node 2 in your setup. You have the choice for either keeping it internal in the DRBD block device or to store it on a separate device/partition. There are some notes online that you get some performance increase if you separate the Meta Data. In my testing, I wanted to keep things rather simple so I went with “internal”. You will then be prompted to create the DRBD Meta-Data. In the pull down menu I select “Create new meta-data”. In a new install there shouldn’t be an existing meta-data. If you wish (in a new install) you could also select “Create new meta-data & destroy data”. The next section is where you’ll have to make a choice depending on your particular setup. In my testing, I used iSCSI block devices, so I selected host primary drbd1 (default) and for file system I selected “Use existing data” and I skipped the initial full sync since it was an empty new install. You have other choices for a file system (ext3, ext4, etc.). If you were going to use iSCSI files as targets (ex. LUN0.bin) then you would format the DRBD volume with the file system of your choice. The pop-up windows are now over and you are now presented with a GUI representation of your newly created DRBD block device. You will see that your primary is green in color and your secondary is yellow. The DRBD resource name (r0) is identifying the arrow which indicates the direction the replication is flowing. You also are given information of the linux device (/dev/sdb1) used to create the DRBD resource and the linux name (/dev/drbd0) of the DRBD volume itself. If you had formatted the device with a file system, you could now use the resource by mounting /dev/drbd0. You could also create LVM volumes withing /dev/drbd0 which will give you the benefits of DRBD replication and the flexibility of LVM volumes withing linux.. I don’t remember exactly what it will do to a pre-formatted volume, but I suspect it will ask you to wipe the existing disk.
That’s the end of this section. DRBD I found by itself to be the most useful and flexible to use for other deployments. A few examples I was investigating was an Apache Web Server setup or a MySQL Server. LCMC has modules for setting up a redundant Web or MySQL server. Maybe I’ll write one of those up in a future article.