Device Boot Start End Blocks Id System /dev/sdb1 1 8322 4194256+ 5 Extended /dev/sdb5 1 2033 1024569 8e Linux LVM
pvcreate -M2 /dev/sdb5 vgcreate vg01 /dev/sdb5 lvcreate -l 100%FREE --name lv_vz vg01
We will use DRBD to mirror the lv_vz logical volume between all nodes.
Setup /etc/drbd.d/global_common.conf.
Note these:
global {
usage-count no;
# minor-count dialog-refresh disable-ip-verification
}
common {
protocol C;
handlers {
pri-on-incon-degr "/usr/lib/drbd/notify-pri-on-incon-degr.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
pri-lost-after-sb "/usr/lib/drbd/notify-pri-lost-after-sb.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
local-io-error "/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o > /proc/sysrq-trigger ; halt -f";
fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
after-resync-target "/usr/lib/drbd/crm-unfence-peer.sh";
# split-brain "/usr/lib/drbd/notify-split-brain.sh root";
# out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root";
# before-resync-target "/usr/lib/drbd/snapshot-resync-target-lvm.sh -p 15 -- -c 16k";
# after-resync-target /usr/lib/drbd/unsnapshot-resync-target-lvm.sh;
}
startup {
# wfc-timeout degr-wfc-timeout outdated-wfc-timeout wait-after-sb;
}
disk {
# on-io-error fencing use-bmbv no-disk-barrier no-disk-flushes
# no-disk-drain no-md-flushes max-bio-bvecs
fencing resource-only;
}
net {
# sndâbuf-size rcvbuf-size timeout connect-int ping-int ping-timeout max-buffers
# max-epoch-size ko-count allow-two-primaries cram-hmac-alg shared-secret
# after-sb-0pri after-sb-1pri after-sb-2pri data-integrity-alg no-tcp-cork
}
syncer {
# rate after al-extents use-rle cpu-mask verify-alg csums-alg
rate 20M;
}
}
Setup /etc/drbd.d/r0.res:
resource r0 {
device /dev/drbd0;
disk /dev/mapper/vg01-lv_vz;
meta-disk internal;
on node1 {
address 10.0.0.101:7789;
}
on node2 {
address 10.0.0.102:7789;
}
}
Restart drbd to take effect:
invoke-rc.d drbd restart
Init the disk:
drbdadm create-md r0 drbdadm attach r0 drbdadm syncer r0 drbdadm connect r0
At the primary node, assign the primary as the sync source and start sync:
drbdadm -- --overwrite-data-of-peer primary r0
Wait for sync complete:
node1:~# cat /proc/drbd
version: 8.3.7 (api:88/proto:86-91)
srcversion: EE47D8BF18AC166BE219757
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----
ns:1420 nr:0 dw:856 dr:21497 al:14 bm:10 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
Then format the DRBD block device as usual:
mkfs.ext3 /dev/drbd0
Let Pacemaker control the start/stop.
update-rc.d -f drbd remove