How to backup a subversion repository

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 us 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 svnadmin load.

If you are interested in running using svn+ssh, take a look at Creating a svn repo with unix permissions.

Published: Monday, 25 July 2011