How to backup and restore all the source code in svn?

MemoryLeak picture MemoryLeak · Sep 10, 2009 · Viewed 20.2k times · Source

Right now I am using Windows XP. If i just copy the whole repository folder in visual SVN, once the server is down, how can i restore it via the backuped repository folder? another better solution to backup and restore in visual svn ?

by the way, any method for backup and restore in visual source control?

Answer

Warren Young picture Warren Young · Sep 10, 2009
svnadmin dump /path/to/repository | bzip2 -9c > svn-backup.bz2

The compression step is optional, of course.

The primary advantage of this over the "copy the tree" method recommended in another answer is that the Subversion "dump" format is a better archival format than most of the database formats used by Subversion under the hood in its repository. (It's a speed vs. simplicity tradeoff.) You can read a dump file in a text editor, parse it easily, and — most important — import it into a different Subversion repository using a different database back-end.

Restore the above file with:

bzip2 -dc svn-backup.bz2 | svnadmin load /path/to/repository