How to backup a subversion repository

Published: Monday, 25 July 2011

How to backup a subversion repository using svnadmin dump

Take a dump of the repository while logged in using a shell on the server. Assuming that the repository resides in the directory /var/svn/com.magicmonster.example, you could use the following:

$ svnadmin dump /var/svn/com.magicmonster.example > com.magicmonster.example.svn_dump
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.

The file com.magicmonster.example.svn_dump will contain a dump of the subversion repository.

To restore the repository, first you create an empty repository using svnadmin create.

Then you can use

zcat com.magicmonster.example.svn_dump | svnadmin load /path/to/repo