Install and Configure a DRBD Device

1 hour
  • 10 Learning Objectives

About this Hands-on Lab

The Distributed Replicated Block Device (DRBD) is a replicated storage solution for Linux. DRBD allows low-level storage block devices to be replicated and synchronized between two host machines, and, in the case of three-way replication, three host machines. In this learning activity, you will set up low-level storage and then use DRBD to replicate and synchronize that block device.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

(Both nodes) Import the GPG signing key and install the repository for `elrepo`.

On both nodes, import the signing key and install the repository.

(Both nodes) Install the required packages for DRBD.

On each node, install the kernel module and utilities.

(Both nodes) Load the DRBD kernel module.

Load the drbd kernel module.

(Both nodes) Start and enable the DRBD service.

Start the service and then enable the service.

(Both nodes) Create a 500 megabyte logical volume named `lv-drbd` with a volume group named `vg-drbd` from the `/dev/xvdg disk`.

Create the physical volume, the volume group, and the logical volume.

(Both nodes) Set protocol C in global config file.

Set replication mode to synchronous in global_common.conf and add protocol C to the net section. After that, we’ll create the resource configuration file for drbd1. The resource is drbd1, the device is /dev/drbd1, disk is /dev/vg-drbd/lv-drbd, meta-disk is internal, and each node listens on 7790.

(Both nodes) Create the device metadata for `drbd1`.

Use drbdadm to create device metadata.

(Both nodes) Start up the DRBD device.

Use drbdadm to start up the device.

Set the DRBD device on `drbd-server1` to be the primary.

Use the drbdadm primary command to set drbd1 on drbd-server1 to primary.

On `drbd-server1`, create an `ext4` file system on the DRBD device and mount it on `/mnt/hr`.

Create the ext4 file system and mount /dev/drbd1 on /mnt/hr.

Additional Resources

The Human Resources department in your company has employee data that needs to be put in a storage cluster in order to prevent data loss. As one of the lead Linux engineers, you are assigned this project. Two hosts have been provisioned in the cluster, node1 and node2, but you will need to set up low-level storage and configure DRBD for replication and synchronization.

Using the /dev/nvme1n1 device, create a volume group named vg-drbd and then a 500 MB logical volume named lv-drbd. After the logical volume is created, install DRBD and configure it to use lv-drbd for a replicated block device. This DRBD device should be called drbd1 and located at /dev/drbd1. The replication mode should be synchronous between the cluster nodes (node1 and node2) and needs to use internal metadata. Once the DRBD device is up and running on both nodes, set the device on node1 to be the primary. Finally, you will need to install an ext4 file system on the drbd1 device on node1 and mount it to /mnt/hr.

Important notes:

  • A 2 GB hard disk, /dev/nvme1n1, has been added to each server for use with LVM.
  • In order to install the required packages for DRBD, you will need to add the elrepo repository and import the GPG key. Please use the following links to import the key and install the repository:
  • The firewall has been disabled for this activity.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?