Picture of Jürgen Kreileder

LVM Snapshots With Debian Sarge and Linux 2.6.16

I have upgraded this server to kernel 2.6.16.2. The next backup cycle resulted in a minor disaster: The backup process deadlocked at removing the first LVM2 snapshot and the snapshot source volumes were blocking write accesses. A cleanup shutdown was impossible and I had to hard-reset the machine.

After some searching I found out that you apparently need lvm2 2.02.01 or later and devmapper 1.02.02 or later to successfully remove snapshot volumes now. Unfortunately neither of these versions is available for sarge from Debian or backports.org yet, so I had to make my own backports.
As it turned out (see below), it is also necessary to use 2.6.16.12 or to apply the patch from this email to older 2.6.16 versions in order to reliably remove snapshots.

If you are brave enough, you can get the backported packages by adding

deb http://blog.blackdown.de/static/debian/lvm/ sarge main
deb-src http://blog.blackdown.de/static/debian/lvm/ sarge main

to /etc/apt/sources.list.

The repository contains debs for devmapper, dlm, lvm2, and lvm-common. The Release files is signed with my GPG key. If you have a recent apt version, you can authenticate the packages after importing the key with apt-key:

wget http://blog.blackdown.de/static/gpg.asc -O - | \
    sudo apt-key add -

April 15th, 2006: In about 40 backup cycles I’ve seen three lockups with 2.6.16.2 now. Until snapshots get fixed in 2.6.16, I’d recommend to stay with 2.6.15. I’m using 2.6.15.3 again now.

April 24th, 2006: Added note about “dm snapshot: fix kcopyd destructor” patch from Alasdair G Kergon. With this patch snapshots work fine for me again.

May 2nd, 2006: Alasdair G Kergon’s patch has been included in 2.6.16.12.

This article Jürgen Kreileder is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

13 Comments

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post. Both comments and pings are currently closed.

Andre Tomt said

Seeing your post on LKML, I take it the backport didn’t help much? Maybe a update is in order – for the googlers

Hey, I was just about to post it :-)

Ook! said

So, umm, what happened to the backports? Am needing to make use of them right now and backporting from etch/sid is being a right pain so since someone had already done it I was hoping to get to use it.

The /etc/apt/sources.list line from the article should work fine.

dkg said

Would you consider making the source available for your backports? In particular, i’m interested in seeing what modifications you made from the packages in etch/sid, so that i can apply them myself should newer versions come along.

Thanks for posting this. Misery loves company ;)

Oh, I thought I’ve uploaded the source too but apparently I didn’t… I’ll upload it tomorrow.

The code is almost identical to the packages from etch. I’ve only changed the version in order to make my packages distinguishable from the real Debian packages.
No other changes were needed. Just rebuilding on sarge was enough.

The source is now available via ‘apt-get source’.

oscar said

Great job.
I am compiling it now. I hope it does the trick.

oscar said

Oooooh. It did. Wonderful.
Thanks for doing this instead of me. :-)

Sébastien Cramatte said

Hi
I’ve got debian sarge +xen with kernel 2.6.16.19
Do I must apply the patch for lvm2 or just upgrade lvm2 tools is suficient ?

Regards

Sébastien, 2.6.16.19 already includes the needed patch, that means you just have to upgrade the lvm2 and devmapper packages.

[…] LVM Snapshots With Debian Sarge and Linux 2.6.16 (tags: linux debian lvm sysadmin) […]

jeremy said

Good job!! It works perfectly, you save my backup :)
thank you very much