As a system admin we know the importance of backup. This article will help you to how to Backup and Restore SVN (Subversion) repository on Linux.

Eg 1. Backup (dump) SVN Repository
# svnadmin dump /var/www/svn/myrepo > /backup/svn/myrepo.dump
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.
....
Eg 2. Compressed Backup (dump) SVN Repository

Following command will take backup of “myrepo” repository and compress it in .gz format.

# svnadmin dump /var/www/svn/myrepo | gzip -9 > /backup/svn/myrepo.dump.gz
Eg 3. Restore (load) SVN Repository

Below example will help you to restore repository from a backup file. For this example we are creating new repository to restore dump.

Create a new repository

# svnadmin create /var/www/svn/mynewrepo

Restore dump to newly created repository

# svnadmin load /var/www/svn/mynewrepo < /backup/svn/myrepo.dump
<<< Started new transaction, based on original revision 1
     * adding path : svn-auth-screen.PNG ... done.
     * adding path : template.txt ... done.

------- Committed revision 1 >>>

<<< Started new transaction, based on original revision 2
     * adding path : file1.txt ... done.
     * adding path : file2.txt ... done.

------- Committed revision 2 >>>