LVM snapshots on client, free space requirement?

Theoretically, or if someone wants to do the work of creating a snapshot script, this seems to be a lvm2 limitation, not a Linux limitation.

To create a script (using raw dmsetup/Linux device manager):

  • Take a look at dm-snapshot and setup snapshot-origin + snapshot manually via dmsetup create
  • As cow device use e.g. a file on a different volume (with losetup -f /path/to/file --direct-io=on)
  • The snapshotted device still must be a lvm2/device mapper file, otherwise its table cannot be changed via dmsetup reload during runtime.
  • Bonus: Allow files on the snapshotted device, by using fallocate, then getting the disk locations via filefrag, then use dm-linear to map the file directly to a device
  • Bonus: Use dm-era to make it “feature-complete” and provide Changed Block Tracking to the client. Dm-era doesn’t seem to be supported by LVM2 either.
1 Like