PDA

View Full Version : Merging LVM Snapshots?



KBOYLE
03-Jul-2012, 20:17
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?

bpmconsultag
04-Jul-2012, 09:03
Hi Kevin

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



# 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

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

# uname -r
3.0.26-0.7-default


Kind regards
Jan Fader

KBOYLE
04-Jul-2012, 21:04
bpmconsultag wrote:


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

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...

Magic31
05-Jul-2012, 06:50
bpmconsultag wrote:


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

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...

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

KBOYLE
05-Jul-2012, 17:14
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.

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.

Magic31
05-Jul-2012, 20:53
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.

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

Magic31
05-Jul-2012, 21:22
Hi Willem,

"dmsetup targets" still doesn't show any snapshot info. Do you have any idea why that might be?


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. :/

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

-Willem

enovaklbank
10-Jul-2012, 10:13
# 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

KBOYLE
10-Jul-2012, 15:05
Thank you!

Magic31
10-Jul-2012, 15:25
# 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

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

Thanks!
Willem