How to backup SVN repository?

sharptooth picture sharptooth · Mar 31, 2011 · Viewed 59.7k times · Source

I often hear that having an SVN repository doesn't cancel need for backups.

How is such backup done? I mean the repository will inflate over time, won't it? So do I back it up as a whole every time or what do I do?

What's the easiest way to do such backups?

Answer

Eugene Yarmash picture Eugene Yarmash · Mar 31, 2011

You could use svnadmin dump. For example, to create a compressed backup file in Linux run:

svnadmin dump -q /path/to/repo | bzip2 -9 > repo_backup.bz2

To restore a backup use svnadmin load:

svnadmin create /path/to/newrepo
bzip2 -cd repo_backup.bz2 | svnadmin load /path/to/newrepo

See also Repository data migration using svnadmin in the SVN Book.