[DRBD-user] LVM Snapshot cavets

Lars Ellenberg lars.ellenberg at linbit.com
Tue Aug 11 18:38:41 CEST 2009

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

On Tue, Aug 11, 2009 at 11:33:41AM -0400, Petrakis, Peter wrote:
> Hi All,
> http://thread.gmane.org/gmane.comp.linux.drbd/6175
> Does this summary still hold true for drbd 8.2.7 and above?


In short:

LVM2 snapshots work just fine, either way, above and below DRBD.

> I'm essentially building a storage plugin for XenServer 5.5 and want to
> make sure I can still do "on the fly" snapshots.
> It's seems to me that I'll have to go with LVM on top of DRBD to achieve
> this. Thanks.

It depends on what you want,
and has not much to do with the summary above.

If you want your snapshots to be replicated as well, and to be available
after switchover, then of course they have to be on top of DRBD,
so you need to use DRBD as PV, and create a VG from there.

For consistency reasons explained elsewhere,
please do only use _one_ drbd PV per LVM2 VG on top of DRBD.

If you want to be able to snapshot on the secondary,
below DRBD, then DRBD of course has to live on top of some LV.

For a file system living directly on a simple device mapper LV, the
"freeze file system" ioctl is done implicitly by the necessary device
mapper suspend call (so the FS gets implicitly frozen and thawn for you
when you do lvcreate -s, at least with recent enough kernel and
userland).  For FS on top of DRBD on top of LV, you need to do that
ioctl_fsfreeze yourself.

The "cleanness" of a snapshot (as defined in the above mentioned
summary) is more an issue of whether or not the file system was quiesced
(frozen), and whether or not that is enough.

Usually you additionally have to "flush" or "freeze" or "checkpoint" or
whatever all the applications using the file system anyways, so in the
script that you probably have which does that for you, you should easily
be able to insert a "freeze the file system" command (e.g. xfs_freeze -f
will do). Don't forget to unfreeze again ;)

If you want both possibilities, it gets "interessting", as you then have
to build a "sandwich" setup (LVM <-> DRBD <-> LVM), and any "lower"
snapshot would snapshot an entire PV (of the upper LVM group).

: Lars Ellenberg                
: LINBIT HA-Solutions GmbH
: DRBD®/HA support and consulting    http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
please don't Cc me, but send to list   --   I'm subscribed

More information about the drbd-user mailing list