lvm thin send/recv
A few days ago i found this mail on the LKML that introduces support for userspace access to LVM thin provisioned metadata snapshots. I didn’t know this is possible.
Using the thin provisioning tools you can then export the metadata information for your LVM snapshots to track changed regions between them.
The workflow is pretty straight forward, yet not really documented:
- Create a base snapshot for a volume on a thin provisioned LVM pool, this snapshot is used as reference for further incremental snapshots:
- Now copy some data to the volume and create another snapshot, additionally
tell the kernel to create a metadata snapshot using
dmsetup
.
- Export an XML description of the differences between the snapshots using the
thin_delta
executable and release the snapshot:
- Parse the resulting XML file and read the blocks reported as “different” and “right only” from the created data snapshot.
This all has already been implemented by a nice utility called
thin-send-recv, which based on this
functionality allows to (incrementally) send LVM snapshots to remote systems
just like zfs send or zfs recv.
Written on May 21, 2024