[DRBD-user] LVM backing snapshot + restore

Charles Lyons - ConnetU charles at connetu.com
Tue Jul 23 19:11:23 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.

Hi all,

We use DRBD on top of LVM - so for every replicated block device we need 
to create, we create an LVM logical volume on each server and then 
create a DRBD resource on top of that LV. Each LV/DRBD is a volume for a 
VM. Whilst dual-primary capability is enabled, this is only enabled 
briefly during VM live migrations; the rest of the time, each resource 
runs in primary/secondary mode.

This has all been working well. We now want to extend this to take 
snapshot backups with restoration.

If we snapshot the LV itself, presumably we'll get a copy not only of 
the VM's volume block data but also of DRBD metadata on the LV (which I 
understand is stored in the end/final segment(s) of the LV).


(1) Is there any danger of this process not giving a DRBD-consistent 
snapshot? Is there anything within DRBD which needs to be flushed/synced 
prior to starting the snapshot (as is the practice with SQL)?

(2) How is best to restore an image file of the LV, assuming the VM is 
offline and, if necessary, the DRBD resource can be 
detached/disconnected on each/both side(s)?

(3) Presumably it doesn't matter if the snapshot is taken on the primary 
or secondary?

The concern is that doing a dd to overwrite the underlying volume, which 
includes rolling back the DRBD metadata, may confuse DRBD somehow. 
Particularly if it's not done in the right way - e.g. if the secondary 
is left connected and only the primary LV is overwritten, the secondary 
will hold newer data and the sync may occur in the wrong direction (as, 
unusually, we want an older version to replace the newer one).

Can anyone with a knowledge of the workings of metadata and the sync 
process advise what would be a correct procedure for underlying-LV 
snapshot restoration? I've tried to research this but not been able to 
find anything easily digestible.

Second related topic: if we've got an existing snapshot, can we use this 
as the basis for creating a totally new DRBD resource... i.e. creating a 
new LV of identical size, dd the image to the LV and then create a new 
DRBD resource on top. Is there anything in the metadata (like global 
UUIDs) which could be duplicated and confuse DRBD? If so, is there a 
recommended way to "reset" the metadata prior to attaching so it will 
appear as a totally new pre-seeded volume?

Thanks for any input,

More information about the drbd-user mailing list