[linux-lvm] Merging snapshots - does lvmerge or similar exist for Linux

Roger Lucas roger at planbit.co.uk
Thu Aug 17 12:59:32 UTC 2006


Hi,

I have seen a few questions about this but could not find any answers.

I am working with Debian, the 2.16.20 kernel and the latest LVM+DMAPPER
releases.

I have a logical volume that I want to be able to make changes to, but
unroll these changes again if necessary.  When the operations are finished,
I want to end up with just one LV and no additional snapshots.  The LV would
either have its original contents or the updated contents, and this decision
isn't made until all the changes have been done.

With LVM2, the snapshots are r/w so I could either:

1) Snapshot the original LV and keep the snapshot safe, then make the
changes to the original LV.  If I don't need to restore the LV after
applying the changes, then I can just delete the snapshot.  If I do want to
restore the original LV, however, what is the best way to flush the changes
in the snapshot back onto the original LV ?

I appreciate that I could just "dd" the snapshot onto the LV to restore its
orignal state, but this will rewrite a lot of data that hasn't actually
changed.  Apart from being slower than I would like, I don't know if writing
exactly the same data to the LV will trigger the data to be written to the
snapshot - if it does then the snapshot will grow in size to the original LV
whilst the "dd" happens, and I do not have enough disk space for that.

Or

2) Snapshot the original LV and make the changes to the snapshot.  If I want
to restore the original LV, then all I need to do is delete the snapshot.
But, if I want to keep the changes (and not have to keep the snapshot), how
can I flush the changes that have been made to the snapshot back onto the
original LV.  

I appreciate that I could just "dd" the snapshot onto the LV to update it to
the new values, but I don't like this for the same reasons as in (1) above.

Is there an "lvmerge" command or similar on Linux LVM.  There appears to be
one for the HP-UX LVM but I couldn't see one for Linux.

Alternatively, is the snapshot disk format easy enough to analyse so that a
lvmerge utility could be written relatively easily ?

Thanks,

Roger





More information about the linux-lvm mailing list