[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: SVN backup with lvm snapshots and rsync

From: Nico Kadel-Garcia <nkadel_at_gmail.com>
Date: Wed, 15 Feb 2012 16:37:22 -0500

On Wed, Feb 15, 2012 at 2:05 PM, Philip Martin
<philip.martin_at_wandisco.com> wrote:
> Stefan Sperling <stsp_at_elego.de> writes:
>
>> But rather than going through that effort, I would recommend using
>> svnadmin dump/load, or svnsync with file:// URLs, until Subversion 1.8
>> is released. At which point you can switch over to using
>> "svnadmin hotcopy --incremental", which will copy rep-cache.db via
>> the appropriate sqlite APIs.
>
> Are you suggesting this because you know the LVM snapshot method doesn't
> work or just because it's a method that avoids non-standard Subversion
> tools?
>
> Running rsync on an LVM snapshot looks like it should work to me.  An

It'll work great until it doesn't.

If the repository is busy in a commit or partial commit at the moment
of the snapshot, you're in potentially very deep trouble. You've
entered not only "split-brain" territory, where the repositories are
out of sync, but partial commit territory. Subversion is careful that
its database writes are atomic operations, but you can't assure that
if the filesystem is in the midst of being written when snapshotted.

You've casually stated "An LVM snapshot freezes the filesystem". No,
it freezes the *partition*, and metadata about the blocks used on the
raw device, and excludes them from further writing (until the buffer
space allocated for LVM overflows. To the casual eye, this looks like
freezing the filesystem, but if you look more closely, I think you'll
find that anything paged out and not yet written to disk will not be
in the snapshot. And modern filesystems do this kind of paging as a
matter of course for performance reasons. Unless you do a "sync"
command, or various low level flush commands, you don't know that you
write to disk has actually made it to the platter.

In a lightly loaded environment, middle of the night, no commits are
going on? No problem. But in that kind of environment, you should have
space to run an rsync based snapshot several times in a row to verify
operational consistency and be done with it, and avoid LVM altogether.
Robust backup takes thought.

In a heavily loaded system that nightly commits regression testing
tags or branches? You have a potential adventure.
Received on 2012-02-15 22:37:54 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.