Backing up and Restoring Your Subversion Repository
From OCS Support Wiki
Contents |
Introduction
This article will show you how to backup and restore your Subversion repository.
One Time Backup or Restore
Login to your SVN / Trac control panel and click SVN repositories under the Services tab on the left hand menu. You will see a list of your Subversion repositories. Click the "Dump" button next to your repository to download a backup file. You can also click "Load" to restore a backup file.
Using the Console
Establish an SSH connection to your designated SVN / Trac server and login with the same username and password you use to obtain access to the SVN / Trac control panel. Once in, run:
svnadmin dump ~/svn/repo_name > repo_name.svn.dump
Replace repo_name with your repository name. This will backup your repository into a file called repo_name.svn.dump. You can then restore a Subversion backup with:
svnadmin load ~/svn/repo_name < repo_name.svn.dump
Automatic Backup
Establish an SSH connection to your designated SVN / Trac server and login with the same username and password you use to obtain access to the SVN / Trac control panel. Once in, run:
crontab -e
This will open up an editor (most likely nano) and allow you to enter in a cron job to automatically prepare a backup dump of your repository. Put the command:
@daily svnadmin dump ~/svn/repo_name > repo_name.svn.dump
at the end of the file (replacing repo_name with your repository name), save, and exit (Use CTRL+X with nano to save and exit, then follow the prompts).
You can replace @daily with @weekly if you prefer.
