Ubuntu/Debian DRBD 8.0 Setup Guide

I've only used it on Centos, so I thought I'd make a quick Debian guide:

Install the DRBD Package

apt-get install drbd8-utils
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libswfdec-0.8-0
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  debconf-utils dpatch drbd8-source patchutils
Suggested packages:
  curl heartbeat
The following NEW packages will be installed:
  debconf-utils dpatch drbd8-source drbd8-utils patchutils
0 upgraded, 5 newly installed, 0 to remove and 19 not upgraded.
Need to get 644kB of archives.
After this operation, 2,277kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://mirror.its.uidaho.edu/pub/ubuntu/ lucid/main debconf-utils 1.5.28ubuntu4 [40.4kB]
Get:2 http://mirror.its.uidaho.edu/pub/ubuntu/ lucid/main dpatch 2.0.31 [88.4kB]
Get:3 http://mirror.its.uidaho.edu/pub/ubuntu/ lucid/main patchutils 0.3.1-2build1 [101kB]
Get:4 http://mirror.its.uidaho.edu/pub/ubuntu/ lucid-updates/main drbd8-source 2:8.3.7-1ubuntu2.1 [220kB]
Get:5 http://mirror.its.uidaho.edu/pub/ubuntu/ lucid-updates/main drbd8-utils 2:8.3.7-1ubuntu2.1 [195kB]
Fetched 644kB in 0s (1,566kB/s)   
Selecting previously deselected package debconf-utils.
(Reading database ... 316693 files and directories currently installed.)
Unpacking debconf-utils (from .../debconf-utils_1.5.28ubuntu4_all.deb) ...
Selecting previously deselected package dpatch.
Unpacking dpatch (from .../archives/dpatch_2.0.31_all.deb) ...
Selecting previously deselected package patchutils.
Unpacking patchutils (from .../patchutils_0.3.1-2build1_i386.deb) ...
Selecting previously deselected package drbd8-source.
Unpacking drbd8-source (from .../drbd8-source_2%3a8.3.7-1ubuntu2.1_all.deb) ...
Selecting previously deselected package drbd8-utils.
Unpacking drbd8-utils (from .../drbd8-utils_2%3a8.3.7-1ubuntu2.1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up debconf-utils (1.5.28ubuntu4) ...

Setting up dpatch (2.0.31) ...
Setting up patchutils (0.3.1-2build1) ...
Setting up drbd8-source (2:8.3.7-1ubuntu2.1) ...
Loading new drbd8-8.3.7 DKMS files...
First Installation: checking all kernels...
Building only for 2.6.32-26-generic-pae
Building for architecture i686
Building initial module for 2.6.32-26-generic-pae
Done.

drbd.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/2.6.32-26-generic-pae/updates/dkms/

grep: /etc/modprobe.d/drbd.conf: No such file or directory
/etc/modprobe.d/drbd.conf: added 'options drbd cn_idx=7'
depmod.....

DKMS: install Completed.

Setting up drbd8-utils (2:8.3.7-1ubuntu2.1) ...

Configure DRBD / Edit /etc/drbd.conf

vi /etc/drbd.conf

# You can find an example in  /usr/share/doc/drbd.../drbd.conf.example

#include "drbd.d/global_common.conf";
#include "drbd.d/*.res";

resource r0 {
  protocol A;

  handlers {
#    pri-on-incon-degr "echo o > /proc/sysrq-trigger ; halt -f";
#    pri-lost-after-sb "echo o > /proc/sysrq-trigger ; halt -f";
    local-io-error "echo o > /proc/sysrq-trigger ; halt -f";
  }

   net {

   after-sb-0pri discard-older-primary;
   after-sb-1pri call-pri-lost-after-sb;
   after-sb-2pri call-pri-lost-after-sb;

   }

  startup {
    degr-wfc-timeout 120;
  }

  disk {
    on-io-error   call-local-io-error;
  }

  syncer {
    rate 80M;
    al-extents 257;
  }

  on QuadCoreAM2 {
    device    /dev/drbd0;
    disk      /dev/sdc3;
    address   192.168.1.125:7788;
    meta-disk internal;
  }

  on one-desktop {
    device    /dev/drbd0;
    disk      /dev/sdc3;
    address   192.168.1.115:7788;
    meta-disk internal;
  }
}


Copy drbd.conf to /etc on the other node (both configs must be the same)

Start DRBD on the main node and then after the second node:

 

service drbd start

        --== This is a new installation of DRBD ==--
Please take part in the global DRBD usage count at http://usage.drbd.org.

The counter works anonymously. It creates a random number to identify
your machine and sends that random number, along with
DRBD's version number, to usage.drbd.org.

The benefits for you are:
 * In response to your submission, the server (usage.drbd.org) will tell you
   how many users before you have installed this version (8.3.7).
 * With a high counter LINBIT has a strong motivation to
   continue funding DRBD's development.

http://usage.drbd.org/cgi-bin/insert_usage.pl?nu=15996461431638930486&git=ea9e28dbff98e331a62bcbcc63a6135808fe2917

In case you want to participate but know that this machine is firewalled,
simply issue the query string with your favorite web browser or wget.
You can control all of this by setting 'usage-count' in your drbd.conf.

* You may enter a free form comment about your machine, that gets
  used on usage.drbd.org instead of the big random number.
* If you wish to opt out entirely, simply enter 'no'.
* To count this node without comment, just press [RETURN]

 

On the main node you will get this:

* Starting DRBD resources                                                                                                                                   [ d(r0) 0: Failure: (119) No valid meta-data signature found.

    ==> Use 'drbdadm create-md res' to initialize meta-data area. <==


[r0] cmd /sbin/drbdsetup 0 disk /dev/sdc3 /dev/sdc3 internal --set-defaults --create-device --on-io-error=call-local-io-error  failed - continuing!
 
n(r0) ]..........
***************************************************************
 DRBD's startup script waits for the peer node(s) to appear.
 - In case this node was already a degraded cluster before the
   reboot the timeout is 120 seconds. [degr-wfc-timeout]
 - If the peer was available before the reboot the timeout will
   expire after 0 seconds. [wfc-timeout]
   (These values are for resource 'r0'; 0 sec -> wait forever)
 To abort waiting enter 'yes' [  27]:

 

drbdsetup /dev/drbd0 primary
/dev/drbd0: State change failed: (-2) Refusing to be Primary without at least one UpToDate disk
 

drbdadm create-md r0

I forgot that my sdc3 is an empty/unused ext3 so I got this error:

md_offset 12839657472
al_offset 12839624704
bm_offset 12839231488

Found ext3 filesystem
    12538732 kB data area apparently used
    12538312 kB left usable by current configuration

Device size would be truncated, which
would corrupt data and result in
'access beyond end of device' errors.
You need to either
   * use external meta data (recommended)
   * shrink that filesystem first
   * zero out the device (destroy the filesystem)
Operation refused.

Command 'drbdmeta 0 v08 /dev/sdc3 internal create-md' terminated with exit code 40
drbdadm create-md r0: exited with code 40

I did a dd if=/dev/zero of=/dev/sdc3 and it fixed it then I ran it again.

drbdadm create-md r0

Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.

I still can't run drbdsetup:

drbdsetup /dev/drbd0 primary -o
/dev/drbd0: State change failed: (-2) Refusing to be Primary without at least one UpToDate disk

Both nodes with cat /proc/drbd are unconfigured

GIT-hash: ea9e28dbff98e331a62bcbcc63a6135808fe2917 build by root@QuadCoreAM2, 2010-12-24 16:34:58
 0: cs:Unconfigured

How to fix it:

I restarted DRBD on the primary node and told it not to wait.

service drbd start
 * Starting DRBD resources                                                                                                                                   [ d(r0) n(r0) ]..........
***************************************************************
 DRBD's startup script waits for the peer node(s) to appear.
 - In case this node was already a degraded cluster before the
   reboot the timeout is 120 seconds. [degr-wfc-timeout]
 - If the peer was available before the reboot the timeout will
   expire after 0 seconds. [wfc-timeout]
   (These values are for resource 'r0'; 0 sec -> wait forever)
 To abort waiting enter 'yes' [  17]:yes

                                                                                                                                                      [ OK ]

Now DRBD is in WFConnection and Secondary mode, this is good:
version: 8.3.7 (api:88/proto:86-91)
GIT-hash: ea9e28dbff98e331a62bcbcc63a6135808fe2917 build by root@QuadCoreAM2, 2010-12-24 16:34:58
m:res  cs            ro                 ds                     p  mounted  fstype
0:r0   WFConnection  Secondary/Unknown  Inconsistent/DUnknown  A

     

Make DRBD primary
drbdsetup /dev/drbd0 primary -o

Start DRBD on the second node and it will begin syncing:

GIT-hash: 9ba8b93e24d842f0dd3fb1f9b90e8348ddb95829 build by ivoks@ubuntu, 2009-01-17 07:49:56
 0: cs:SyncTarget ro:Secondary/Primary ds:Inconsistent/UpToDate A r---
    ns:0 nr:463808 dw:463552 dr:0 al:0 bm:27 lo:10 pe:367 ua:8 ap:0 ep:1 wo:b oos:12074760
    [>....................] sync'ed:  3.8% (11791/12244)M
    finish: 0:03:28 speed: 57,944 (57,944) K/sec

 


 


Tags:

ubuntu, debian, drbd, guidei, ve, centos, install, apt, utils, lists, dependency, packages, automatically, installed, libswfdec, autoremove, debconf, dpatch, patchutils, curl, heartbeat, upgraded, newly, kb, archives, additional, disk, http, uidaho, edu, pub, lucid, updates, fetched, selecting, previously, deselected, database, directories, currently, unpacking, utils_, _all, deb, dpatch_, patchutils_, _i, source_, processing, triggers, db, ureadahead, loading, dkms, installation, kernels, generic, pae, architecture, initial, module, ko, sanity, kernel, installing, lib, modules, grep, etc, modprobe, conf, directory, cn_idx, depmod, completed, configure, edit, vi, usr, quot, global_common, res, resource, protocol, handlers, pri, incon, degr, echo, proc, sysrq, halt, sb, io, discard, primary, startup, wfc, timeout, syncer, extents, quadcoream, dev, sdc, meta, desktop, node, configs, global, usage, org, anonymously, creates, benefits, submission, server, users, linbit, motivation, funding, cgi, bin, insert_usage, pl, nu, git, ea, dbff, bcbcc, fe, participate, firewalled, query, browser, wget, opt, valid, drbdadm, md, initialize, cmd, sbin, drbdsetup, defaults, continuing, waits, peer, degraded, cluster, reboot, expire, abort, refusing, uptodate, unused, ext, md_offset, al_offset, bm_offset, filesystem, usable, configuration, truncated, corrupt, errors, external, recommended, drbdmeta, terminated, exited, dd, initializing, initialized, bitmap, successfully, nodes, unconfigured, hash, cs, restarted, ok, wfconnection, secondary, mode, api, proto, ro, ds, mounted, fstype, inconsistent, dunknown, syncing, fb, ddb, ivoks, synctarget, ns, nr, dw, bm, pe, ua, ap, ep, wo, oos, sync,

Latest Articles

  • How high can a Xeon CPU get?
  • bash fix PATH environment variable "command not found" solution
  • Ubuntu Linux Mint Debian Redhat Youtube Cannot Play HD or 4K videos, dropped frames or high CPU usage with Nvidia or AMD Driver
  • hostapd example configuration for high speed AC on 5GHz using WPA2
  • hostapd how to enable and use WPS to connect wireless devices like printers
  • Dell Server Workstation iDRAC Dead after Firmware Update Solution R720, R320, R730
  • Cloned VM/Server/Computer in Linux won't boot and goes to initramfs busybox Solution
  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues
  • isc-dhcp-server dhcpd how to get longer lease
  • nvidia cannot resume from sleep Comm: nvidia-sleep.sh Tainted: Linux Ubuntu Mint Debian
  • zfs and LUKS how to recover in Linux
  • [error] (28)No space left on device: Cannot create SSLMutex Apache Solution Linux CentOS Ubuntu Debian Mint