For a while now, we've been using "hot" backups for our SVN repositories using the hot-backup.py Python script file that is part of the Subversion tools and contrib project. A "hot" backup is a way to take a complete snap shot of the repository so in case your repository goes awry, you cake take the hot back up and drop it straight in! For those of you interested in learning more about the backup features of SVN, check out Repository Backup section of the online SVN Book.
Here's an excerpt from the SVN book that describes what hot-backup.py provides for you:
This script adds a bit of backup management atop svnadmin hotcopy, allowing you to keep only the most recent configured number of backups of each repository. It will automatically manage the names of the backed-up repository directories to avoid collisions with previous backups, and will “rotate off” older backups, deleting them so only the most recent ones remain. Even if you also have an incremental backup, you might want to run this program on a regular basis. For example, you might consider using hot-backup.py from a program scheduler (such as cron on Unix systems) which will cause it to run nightly (or at whatever granularity of Time you deem safe).
Another cool feature of the script is the ability to create a compressed (zip/gzip/tar) version of your hot backup, so once the script is done running the contents of the repo will be placed nicely into a zip file. From here you can then take the zip file and store it to tape, email it or do whatever with it.
Our current back up process for SVN is:
- Run the backup batch file every 3 hours
- Zip all the backups
- Move them to a shared network drive that gets backed up to tape
It may seem a little excessive, but since it's all automated it's not that big a of deal. The shared network drive was already setup to back up to tape, so I just created a directory under it where our zip files are placed under so setting it up was non-trivial.
The thing that made this process pretty straight forward was that we currently have a repository for every project (currently this setup works, but we are evaluating other options) that live under the svn_repos directory in our SVN box. In that same box, we have another folder called svn_backups where the backup "work" takes place before it is moved to the shared network drive.
A snapshot of our svn_repos folder looks like this:
- <drive>:\svn_repos
- \project1Repo
- \project2Repo
- etc...
I then run this simple DOS batch script using Task Scheduler to run the back up (I've removed the copy to the shared drive since you get the point):
echo off
dir /b /ad <drive>:\svn_repos > dir_list.txt
for /f "tokens=1" %%p, in (dir_list.txt) do (
echo Backing up...%%p
hot-backup.py --archive-type=zip <drive>:\svn_repos\%%p <drive>:\svn_backups
)
del dir_list.txt
Pretty straight forward! Hope this helps!