Skip to contentSkip to conversation

"create snapshots of any block device"

DISCUSSION Hauke Laging 2 participants 2 messages Jan 22, 2013 Device mapper

lore
Share & tools
lore
#0 lore raw

Hello,

I am a bit surprised to read this:
"Device-mapper allows you, without massive data copying:

*) To create snapshots of any block device [...]"

here:
http://www.kernel.org/doc/Documentation/device-mapper/snapshot.txt

Isn't that at least misleading? Is it really possible to create a snapshot of e.g. /dev/sda5 without creating an *additional* device as snapshot origin?

I export LVs to a VM where they appear as regular disks so that I cannot use LVMs snapshot integration. Thus I create a dm device with a linear mapping to each of these disks and mount the dm device, not the disk.

I just had the idea to create these dm layer devices as snapshot-origins from the start (instead of loading this target when a snapshot is really going to be created). Is there anything to be said against this? Is there any reason at all to use linear instead of snapshot-origin for devices with just one target (except for possible confusion)?

Hauke

Signature · 3 lines
☺
PGP: 7D82 FB9F D25A 2CE4 5241 6C37 BF4B 8EEF 1A57 1DF5 (seit 2012-11-04)
http://www.openpgp-schulungen.de/
#1 lore raw
Quoted 2 lines · Hauke Laging

Isn't that at least misleading? Is it really possible to create a snapshot of e.g. /dev/sda5 without creating an *additional* device as snapshot origin?

It's possible but as you note you have to create the dm layers for the snapshot. This means that if a non-dm device is in use you have to shut its users down (unmount file systems etc.), create the snapshot and then re-mount.

I've frequently used this in the past to snapshot large zero targets to create sparse devices for testing (before --virtualsize was added to LVM2).

With device-mapper devices this is unnecessary since the top-level device may be suspended while the snapshot layers are inserted.

Regards,
Bryn.