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

RE: How to safely back up an svn repository on ubuntu?

From: Juan Gabriel Covas <jgcovas_at_softline.es>
Date: Wed, 13 Jan 2021 12:12:22 +0000

If it helps, I use the following one-liner to "svnadmin hotcopy --incremental", so only new revisions are copied each time (the svn-hot-copies target path is a NFS mount, for example, in other box)

# find /path/to/your/repos -maxdepth 1 -mindepth 1 -type d -printf "%f\0" | sort -z | xargs -0 -I % sh -c 'echo %; svnadmin hotcopy --incremental /path/to/your/repos/% /path/to/svn-hot-copies/repos/%;'


Juan G. Covas
Balearic Islands

De: Mark Phippard <markphip_at_gmail.com>
Enviado el: miércoles, 13 de enero de 2021 12:54
Para: Bo Berglund <bo.berglund_at_gmail.com>
CC: Subversion <users_at_subversion.apache.org>
Asunto: Re: How to safely back up an svn repository on ubuntu?

On Wed, Jan 13, 2021 at 6:16 AM Bo Berglund <mailto:bo.berglund_at_gmail.com> wrote:
I would like to set up a cron job to backup the repositories on an svn server to
a Synology NAS.

The repositories reside in /var/lib/svn and comprise about 6 Gb worth of files
in 12 different directories.
These are svnsync:ed nightly from our main SVN server in the main office across
the world as a backup of the development activities there.
The main svn server is VisualSvn on Windows Server 16 if that matters. The
svnsync has worked fine for 2+ years since I set it up.

The backup SVN server runs on an Ubuntu 18.4 LTS server in my home network and
on that network I also have a Synology NAS, which I want to use as a 3rd level
backup for the SVN repositories in case the Ubuntu server here crashes.

I got a problem with it a few days ago when we had a power outage and the Ubuntu
box did not boot properly when power returned. Now fixed but it raised the
concern over backup security.

I have now set up an NFS connection between the Ubuntu server and the Synology
NAS so I have a target dir in Ubuntu in /nfs/backup where I can write the files.

So what I had in mind is to somehow keep a copy of the repository files on the
nfs share but I am not sure what command would be suitable to perform this

I could use tar but that would be complex since there are certainly not many
files that change from one day to the other. Only changed files should be copied
to reduce the time of backup.
Or else perhaps rsync, provided it knows which files have changed and which have
not etc.

I am a user of Ubuntu Linux for some of my work and have had to learn the basics
of managing Linux, but I am not versed in these actions. Daily I am a Windows

I don't know if some actions should be done towards svn on the ubuntu server in
order to safely copy the files either...

I would use rsync. Especially since this sounds like it is mainly a last resort backup. There are some relatively minor problems that can happen if rsync happens to run in the middle of a transaction.  The rsync still works but it could make a backup of the repository in an incomplete state. Those problems are fixable and the next rsync would still work and would fix the problem too.

The safer way is to use svnadmin hotcopy but you would have to script it since you need to run it for each repository. The advantage of rsync is that you can just process the entire root folder where your repositories are stored.

Mark Phippard
Received on 2021-01-13 13:52:19 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.