Monthly Archives: January 2016

DRBD quick cheat sheet

Creating volume

/etc/drbd.d/raid10.res
resource raid10 {

  protocol B;

  on hostname1 {
    device    /dev/drbd1;
    disk      /dev/raid10_vg/drbd;
    address   [localIP]:7789;
    meta-disk internal;
  }
  on hostname2 {
    device    /dev/drbd1;
    disk      /dev/raid10-vg/drbd;
    address   [localIP]:7789;
    meta-disk internal;
  }
}

Both nodes:

drbdadm create-md [resource]
drbdadm up [resource]

Primary node:

drbdadm primary --force [resource]

cat /proc/drbd
version: 8.4.3 (api:1/proto:86-101)
srcversion: 6551AD2C98F533733BE558C

 1: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent B r-----
    ns:7552704 nr:0 dw:0 dr:7552936 al:0 bm:460 lo:47 pe:12 ua:47 ap:0 ep:1 wo:f oos:97303516
    [>...................] sync'ed:  7.3% (95020/102396)Mfinish: 0:15:29 speed: 104,672 (96,804) K/sec

Resize

Both nodes:

lvresize /dev/raid10-vg/drbd -L+100G
  Extending logical volume drbd to 200.00 GiB
  Logical volume drbd successfully resized

resize with resync:

drbdadm resize [resource]

resize without resync (added clean space):

drbdadm -- --assume-clean resize [resource]

Resize filesystem:

resize2fs /dev/drbd1

Fix splitbrain

slave:

drbdadm secondary all
drbdadm connect --discard-my-data all

master:

drbdadm connect all