[DRBD-user] DRBD and LVM Snapshot with 2 nodes configuration

Lars Ellenberg Lars.Ellenberg at linbit.com
Tue Apr 6 20:11:20 CEST 2004

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


/ 2004-04-06 19:06:53 +0200
\ Andreas Semt:
> Oh, really? Thought I've read somewhere don't do this. Very good to 
> know. Why LVM2 or is LVM1 also acceptable?

LVM2 because of its filtering capabilities.
you need to exclude the lower level devices from beeing scanned.

lvm1 will see the lower level devices first, and then try to access them
directly, bypassing drbd, or try to setup some "multipathing", or most
likely just not recognize the VG properly and refuse to activate it.

> Mhm, i see ... stop_all_services won't be a good solution, cause these 
> services should be high available, it's a HA cluster ;-)
> The snapshot should be created _while_ all services are running.

Now, during a failover, which is what you suggested, you have all
services down, anyways. Though for a short time only, the time needed to
shut them down cleanly on the active node, and start them up on the
former standby...
So strictly speaking, I did not suggest somthing different :)
in the moment when they are all down, you could do
"lvcreate snapshot", which is very fast.

> What exactly means *clean*? Is that the problem you above-mentioned, 
> i.e. making a snapshot while drbd is online?

I distinguish it this way:

consistent: *always* the case on both nodes,
  as long as you use protocol C, and there is no sync running
  (and no sync was interrupted before)
  But it may be not "clean": if you crash the primary, or just unplug
  the network, the secondary is consistent, but it might have been half
  way through a write transaction, maybe a journal update.
  So before you can mount it, you need at least a journal replay, or
  even a fsck.

clean: *NO* pending transaction. 

  lvm snapshot has a special "Hey, you, file system on top of me,
  please flush your meta data, and suspend" syscall for this, then
  creates the snapshot mapping, and finally tells the file system
  "Ok, I'm done, you may resume now".
  But it expects the file system to be directly registered with it.
  Stacking drivers like DRBD do not register as a file system, so
  the mentioned syscalls won't have any effect. Getting a clean
  snapshot this way is just tough luck.

To make things work *while drbd is online*, one would need to hack
up lvm (either the driver, or the user level tools, or both) to
recognize and respect stacking drivers, figure out the user
(typically the file system) at the top of the stack, and notify
that one.

> Thanks for help, possible these questions should go on a
> "drbd-newbie" list.

This is perfectly the right place for this kind of questions.

  	Lars Ellenberg



More information about the drbd-user mailing list