SVNBackup – Incremental Backup and Restore Utilities for SVN

SVNBackup was borne of some issues I faced while working on a client’s servers. They had previously been using ‘svnadmin hotcopy’ to make their backups, but that had a few of limitations:

  • SVN hotcopy backups needed to be rebuilt when I restored them to a version of SVN built with a different DB back-end. This requires rebuilding the SVN database, which is time consuming and annoying since svnadmin doesn’t give any indication of progress as it works.
  • Because of the size of the hotcopy backups, they were only being run nightly, which could result in up to 24 hours of lost work if the system had to be recovered from backup.

So, I scripted up a way to use ‘svnadmin dump’ and ‘svnadmin load’ for full and incremental backups of SVN that are back-end DB independent. Not only can it be used as a backup system, but it can be used to migrate between versions and builds of subversion. Because of its efficiency it can be run as often as you want, so that your incremental backups catch every check-in.

Current version is .15-beta, and can be found here: SVNBackup-15B.zip

If you would like to be notified when there are updates to SVNBackup, or submit a bug, please visit the Freshmeat page for this project: http://freshmeat.net/projects/svnbackup

Recent changes include:

#############################################################################
#                                                                           #
# Version .15-beta changes                                                  #
# - Fixed an issue where moving the backup directory would cause            #
#   svnrestore.pl to see the backup as invalid.                             #
#                                                                           #
# Version .14-beta changes                                                  #
# - Fixed bad logic in the utility file path code.                          #
# - Added a set of common path locations to the search path.                #
#                                                                           #
# Version .13-beta changes                                                  #
# - Improved lock file detection to prevent concurrent execution, and added #
#   a message stating the age of the lockfile if one is found.              #
#                                                                           #
# Version .12-beta changes                                                  #
# - Fixed an incorrect file test operator in svnrestore.pl                  #
#                                                                           #
# Version .11-beta changes                                                  #
# - Added backup and restore of the conf/ and hooks/ directories.           #
# - Preserve and restore the user/group ownership of the SVN repository.    #
#                                                                           #
# Version .10-beta changes                                                  #
# - Added locating utilities from within PATH so that this script should    #
#   run without modification on most systems.                               #
#                                                                           #
# Version .9-beta changes                                                   #
# - Added using /tmp/svnbackup-BACKUPDIR.lock as a lock-file to prevent     #
#   concurrent execution of svnbackup.pl or svnrestore.pl which could       #
#   corrupt backups and prevent complete restores.                          #
# - Added error handling in case the external call to svnadmin fails.       #
#                                                                           #
#############################################################################

Please, give it a try and let me know what you think. If there is interest I’ll set up a mailing list for discussion.

The software license doesn’t require this, but it would be very nice that if you use this code to backup your SVN system that you find someplace appropriate to link back to this page. I could use the Google karma. :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>