How to Install DRBD on Debian Latest

DRBD is an open-source software that enables mirroring of data between two nodes. This tutorial will guide you through the installation process of DRBD from http://drbd.linbit.com/ on Debian Latest.

Prerequisites

Before starting with the installation process, make sure that your Debian Latest system is up-to-date by running the following commands in your terminal:

sudo apt-get update
sudo apt-get upgrade

You will also need to have root access to your system or have sudo privileges.

Installation

  1. Add the Linbit GPG key to your Debian system by running the following command:

    wget -O - https://repo.linbit.com/linbit.gpg | sudo apt-key add -
    
  2. Add the Linbit repository to your system by running the following command:

    echo "deb https://packages.linbit.com/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/linbit.list
    
  3. Update the package list by running the following command:

    sudo apt-get update
    
  4. Install DRBD by running the following command:

    sudo apt-get install drbd-utils
    
  5. Once DRBD is installed, you need to configure it. Edit the /etc/drbd.conf file using your favorite text editor:

    sudo nano /etc/drbd.conf
    
  6. You will need to configure DRBD for your particular use case. The configuration file should have the following structure:

    global {
        usage-count no;
    }
    
    common {
        protocol C;
    }
    
    resource r0 {
        device /dev/drbd0;
        on node1 {
            address 10.0.0.1:7788;
            disk /dev/sda1;
            meta-disk internal;
        }
        on node2 {
            address 10.0.0.2:7788;
            disk /dev/sda1;
            meta-disk internal;
        }
    }
    

    This configuration file creates a resource called r0 that will mirror the data on /dev/sda1 between two nodes with IP addresses 10.0.0.1 and 10.0.0.2.

  7. Once the configuration file has been edited, you need to initialize the DRBD metadata on both nodes by running the following command:

    sudo drbdadm create-md r0
    
  8. Finally, start the DRBD resource by running the following command:

    sudo drbdadm up r0
    

    The DRBD resource should now be available on both nodes.

Conclusion

In this tutorial, you learned how to install DRBD from http://drbd.linbit.com/ on Debian Latest. You also learned how to configure and start a DRBD resource. With this knowledge, you can build highly available clusters that are resilient to data loss.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!