Merging LVM Snapshots?

An LVM Snapshot allows you to see a logical volume as it was when the snapshot was created. As new data is added/changed on the original LV the old data is copied to the snapshot volume. If you access the original LV, you see all the most recent changes. If you access the data via the snapshot volume, you will always see the data as it was when the snapshot was created. This is exactly the behavior you want to backup the original LV at a given point in time. When the backup has finished, you remove the snapshot. The original LV already has all the updated data and everything is back to normal.

But what happens if you don’t want the updates? For example, you took a snapshot because you wanted to apply a service pack and it did not complete as you expected. In this case, the data in the LV snapshot volume has to be merged back into the original LV before the LV snapshot volume is removed. This is done with the lvconvert command.

server:~ # man lvconvert
<snip>
       --merge
              Merges a snapshot into its origin volume.  To check if your ker-
              nel supports this feature, look for 'snapshot-merge' in the out-
              put of 'dmsetup targets'.  
<snip>

server:~ # dmsetup targets
striped          v1.4.0
linear           v1.1.0
error            v1.0.1

server:~ # cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2

So, based on the above and the fact that I cannot find any reference to the merge option in the documentation, it would appear that SLES does not yet support lvconvert – merge. Can someone confirm this or am I missing something?

Hi Kevin

On our SLES11-SP2-Servers the merging of lvm-Snapshots is supported:

Kind regards
Jan Fader

bpmconsultag wrote:

[color=blue]

On our SLES11-SP2-Servers the merging of lvm-Snapshots is supported:[/color]

Hi Jan,

That is very helpful and encouraging.

Thank you.


Kevin Boyle - Knowledge Partner
If you find this post helpful and are using the web interface,
show your appreciation and click on the star below…

[QUOTE=KBOYLE;5449]bpmconsultag wrote:

[color=blue]

On our SLES11-SP2-Servers the merging of lvm-Snapshots is supported:[/color]

Hi Jan,

That is very helpful and encouraging.

Thank you.


Kevin Boyle - Knowledge Partner
If you find this post helpful and are using the web interface,
show your appreciation and click on the star below…[/QUOTE]

I’ve actually also just started testing this functionality on SLES 11 SP2, and it’s looking as a very good way to quickly roll back.
Need to extend my testing further before really using this in production (aim is to use this for OS system disks of VM’s running on Xen / KVM servers)…

Always great to hear others experiences on the matter.

Cheers,
Willem

Hi Willem,

“dmsetup targets” still doesn’t show any snapshot info. Do you have any idea why that might be?

This server was updated from SLES10-SPx–>SLES11–>SLES11-SP1–>SLES11-SP2. I’m using the Xen kernel.

The server has a few other issues. If this isn’t something obvious that I overlooked, I may just open an SR.

[QUOTE=KBOYLE;5472]Hi Willem,

“dmsetup targets” still doesn’t show any snapshot info. Do you have any idea why that might be?

This server was updated from SLES10-SPx–>SLES11–>SLES11-SP1–>SLES11-SP2. I’m using the Xen kernel.

The server has a few other issues. If this isn’t something obvious that I overlooked, I may just open an SR.[/QUOTE]

Hi Kevin,

No idea… the tests I did where on a plain fresh SLES 11 SP2 install right after it was released.

IIRC I just created a snapshot of an LVM volume… wrote some changes to the original volume, dismounted and ran ‘lvconvert --merge -v snapshotname’.

Haven’t looked at this since then, but I will have the chance next Tuesday to get back to this in a new environment I’m setting up. Could be this does not work when running with the Xen kernel, but I would not expect this to be the issue(?).

Will let you know how it goes!

Cheers,
Willem

[QUOTE=KBOYLE;5472]Hi Willem,

“dmsetup targets” still doesn’t show any snapshot info. Do you have any idea why that might be?
[/QUOTE]

Hmmm… just did a quick test using a SLES 11 SP2 Live CD & now getting the error ‘snapshot-merge target missing from kernel?’

Not sure what I did before or if it’s due to missing packages on this Live CD. “dmsetup targets” shows snapshot and snapshot-origin support, but no snapshot-merge. :confused:

I’ll check this further next week as I’ll have access to a proper setup.

-Willem

dmsetup targets

striped v1.4.0
linear v1.1.0
error v1.0.1

lsmod | grep dm

dm_mod 86149 0

modprobe dm-snapshot

dmsetup targets

snapshot-merge v1.1.0
snapshot-origin v1.7.1
snapshot v1.10.0
striped v1.4.0
linear v1.1.0
error v1.0.1

Thank you!

[QUOTE=enovaklbank;5530]# dmsetup targets
striped v1.4.0
linear v1.1.0
error v1.0.1

lsmod | grep dm

dm_mod 86149 0

modprobe dm-snapshot

dmsetup targets

snapshot-merge v1.1.0
snapshot-origin v1.7.1
snapshot v1.10.0
striped v1.4.0
linear v1.1.0
error v1.0.1[/QUOTE]

DOH next time I should make better notes… which I normally do.

Thanks!
Willem