[DRBD-user] A Summary of LVM snapshots with DRBD

Lars Ellenberg l.g.e at web.de
Thu Apr 8 12:35:18 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.

The problem is: snapshotting a DRBD device.
For *why* this might be a problem, read the other thread again ;)

 "consistent" denotes data that is useable, but usually needs a
 journal replay/undo of certain pending transactions, or even a
 short fsck or similar, to actually be clean.

 "clean" denotes data that is consistent
 and has *no* pending transactions.

To snapshot a DRBD device, you have several options.

You can use LVM2 on top of DRBD. Then for the process of taking
	the snapshot, you can ignore DRBD, and just do as usual.
	You need to take the snapshot on the DRBD primary!

	For LVM2 on top of DRBD, you need to configure certain
	filter settings, otherwise LVM would bypass DRBD and
	recognize and access the lower level devices directly.
	See: http://thread.gmane.org/gmane.linux.network.drbd/4813

If you insist on using DRBD on top of LVM,
	you can still do clean snapshots, you do not need to stop
	drbd, you do not need to make the primary secondary, you
	can take the snapshot on either node.
	But you will have a *short downtime*, as long as it takes
	to shut down all services cleanly, umount, create the
	snapshot, mount, and start the services again.

If you don't care about a the *cleanness*, and are satisfied with
	a merely consistent snapshot (see Definition above), just
	do your snapshot anytime and any node, ignoring the
	existence of DRBD... and if it does not work, (you are not
	able to access or use it, because it is not clean enough),
	try again: snapshot creation is racing with the users
	modifing the device (applications and file system) for a
	clean view of the data.

There are file systems that have their own suspend and resume
hooks. One of them is XFS, which will only work with DRBD 0.7+
If you happen to use some of these, you can always do a clean
snapshot by suspending the active (mounted) file system,
creating the snapshot, and tell the fs to resume again.

Eventually we will built in into the user space tools or into the
module, or both, some hooks to guarantee a clean snapshot.
This does not seem to be that difficult, but it will take some
time to do it right, and somebody just has to do it :)


	Lars Ellenberg

More information about the drbd-user mailing list