Drbd-utils

From ArchWiki

****************WORK IN PROGRESS****************

DRBD is a method that replicates a block device between 2 machines by intercepting the i/o's at the kernel level and sending them to the remote machine

Installation

Install the drbd-utilsAUR package

Backing Device Configuration

Block Device (part/md/disk)

//todo

Loop Device (file)

# mkdir /havol
# fallocate -l10G test.img
# losetup /dev/loop100 /havol/test.img

DRBD Global Config

Append to the bottom of the common section

/etc/drbd.d/global_common.conf
syncer {
    rate 4194304k; # For a 1G network use 500 megabit
    al-extents 6433;
}

DRBD Resource Config

Create the DRBD resource Config I would recomend to keep the numbering of the DRBD device, loop device and port consistent to make tracking easy e.g. /dev/loop100 /dev/drbd100 port 7100

Edit /etc/drbd.d/test.res

with the following:

resource test {
   protocol C;
   startup { wfc-timeout 0; degr-wfc-timeout 120; }
   disk {
       on-io-error detach;
       c-fill-target 10M;
       c-max-rate 4G; #On a 1G link use 300M
       c-plan-ahead 7;
       c-min-rate 4M;
   }
   net { cram-hmac-alg "sha1"; shared-secret "ReplaceMeWithARandomStringAbout32Char"; }
   on Node1 {
       device /dev/drbd100;
           disk /dev/loop100;
           meta-disk internal;
           address 169.254.32.1:7100;
   }
   on Node2 {
       device /dev/drbd100;
       disk /dev/loop100;
       meta-disk internal;
       address 169.254.32.2:7100;
   }
}