[DRBD-user] Some Questions About Nested LVMs Under DRBD

Aaron Clausen mightymartianca at gmail.com
Wed May 29 22:48:24 CEST 2013

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


I've just set up DRBD 8 (8.3) on a KVM host with the secondary (for
the moment) being an old server, just to make sure my KVM images are
secured against primary failure. At the moment I'm not interested in
clustering.

What I've done is set up a nested LVM, so that each KVM guest has its
own logical volume, and that way I can eventually load balance (when I
reconfigure my other KVM server to use drbd). As an added wrinkle,
because these guests are being used to work on some confidential data,
we are contractually required to have everything encrypted, so the
main LVM is encrypted with LUKS. I actually have the set up working
and one KVM guest is up and running and working great.

My questions surround automating the restart process. Obviously, on
reboot (or if the encrypted LVM is unmounted), someone will have to
enter a password, but I can script for that pretty easily. What I'm
more concerned about is bringing up the DRBD array properly, and
failing gracefully.

This is the barebones scripts I have so far

On the primary:
#!/bin/sh
if ! cryptsetup luksOpen /dev/mapper/kvmserver02-guestscontainer vg-guests; then
  echo "Invalid password";
  exit 1;
fi
vgchange -a y vg-guests
modprobe drbd
service drbd start
drbdadm primary drbd-guest1
drbdadm primary drbd-guest2
mount /dev/drbd/by-res/drbd-guest1 /var/lib/libvirt/images/guest1
mount /dev/drbd/by-res/drbd-guest2 /var/lib/libvirt/images/guest2

On the secondary:
#!/bin/sh
if ! cryptsetup luksOpen /dev/mapper/backupserver-guestscontainer
vg-guests; then
  echo "Invalid password";
  exit 1;
fi
vgchange -a y vg-guests
modprobe drbd
service drbd start
drbdadm secondary drbd-guest1
drbdadm secondary drbd-guest2

This seems lacking to me. What if the backup server doesn't come on
line? How do I force the primary online if that happens?

--
Aaron Clausen
mightymartianca at gmail.com



More information about the drbd-user mailing list