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

backups using LVM snapshots and "svnadmin lstxns"

From: Ronan <ronan.mcgoran_at_furioustribe.com>
Date: Wed, 15 Feb 2012 11:35:25 +0000

I want to back up a filesystem on a Linux machine, by taking
an LVM snapshot of the filesystem then copying it to a remote
server. However, there are Subversion repositories on the
filesystem, and I'm concerned that there could be a commit
under way to one or more of these repositories at the instant
that I take the snapshot, which could result in my getting a
corrupted SVN repository in the backup.

I think I have a solution to this problem, which I present in
the following PHP code. (It should be intelligible to anyone
who knows a C-like language.) Does anyone know whether the
solution will work?

  ######### code begins here

  do {
    make_snapshot();

    $transaction_found = FALSE;

    foreach ($repository_on_snapshot as $dir) {
      if(system("svnadmin lstxns $dir") !== '') {
        $transaction_found = TRUE;
        break;
      }
    }
  } while($transaction_found);

  # all the SVN repositories are consistent,
  # so continue with the backup...

  ######### code ends here

The SVN book strongly implies that the solution will work,
but I would prefer to have an explicit assurance on this point.

I'm not subscribed to this list, so please copy me on any
replies.
Received on 2012-02-15 13:18:33 CET

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