SVN Repositories Backup and Restore

As always, there are several ways to backup and restore a SVN repository.
At this place we show two possible ways. One is backup and restore of a local SVN repository by command shell and second is restore and backup of a remote SVN repository by svnrdump.
And if you have to backup a lot of SVN repositories, we have another idea.

The Local Way to Backup and Restore SVN Repositories

Backup a local SVN repository over a SSH Console

The backup is done on the SSH console by using the SVN dump command specifying a file into which should be saved.

svnadmin dump /path/to/repository > svnexport.dump

The created file svnexport.dump now contains the complete repository with all revisions.
Please note that no hooks are secured with this SVN backup. These are located in the folder / PathToRepository / hooks and should be saved manually.

How to restore a local SVN repository by a SSH Console

The import of the dump file is just as easy, but of course must be a existing repository. If the SVN repository is not yet available use svnadmin create /path/to/repository.
Furthermore, it does not have to be imported in the same SVN repository path as the path from which the SVN repository was exported.

svnadmin load /path/to/repository < svnexport.dump

Compressed SVN Dump and Restore

As usually the dumps can be very large files, it is advisable to compress the dump. This can be done in a simple line at the command shell and this saves typically more than 50% of disk space.

svnadmin dump /path/to/repository | gzip -9 > svnexport.dump

The restore of a gzip compressed SVN repository is also possible as a simple one-liner.

gunzip -c svnexport.dump | svnadmin load /path/to/repository

The Remote Way to Backup and Restore SVN RepositoriesΒΆ

Backup a Remote SVN Repository

Backing up is also done on a console using SSH svnrdump.
All you need is the URL of the repository, and as before, the file name for the dump.

svnrdump dump http://domain.tld/repo > svnexport.dump

If you need to authenticate with user and password against your SVN repository, use this command.

svnrdump dump http://domain.tld/repo > svnexport.dump --username admin --password admin --non-interactive

The created file svnexport.dump now contains all the repository revisions.
The remote SVN export is only possible with remote SVN servers from version 1.4!

Restore remote SVN repository

The import of the dump file is just as easy, but of course it must be existing repository.
For remote import into a SVN server, at least SVN server version 1.7 is required.

svnrdump load http://domain.tld/repo < svnexport.dump
# or, if the username and password are required
svnrdump load http://domain.tld/repo < svnexport.dump --username admin --password admin --non-interactive

In the best case will now start the import and all is well.
But in 99.99% of all cases you obtained now this error:

svnrdump: E175002: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
svnrdump: E175008: At least one property change failed; repository is unchanged
svnrdump: E175002: Error setting property 'rdump-lock':
Repository has not been enabled to accept revision propchanges;
ask the administrator to create a pre-revprop-change hook

In this case, the target SVN repository hook 'pre-revprop-change' must be installed.
This is of course only possible if you have access to the file system at the target.
In the Hook directory the executable file pre-revprop-change with Exit 0 have to be created.
Use the following one-liner to create the hook script and make it executable.

printf '#!/bin/sh\nexit 0' > /path/to/repository/hooks/pre-revprop-change && chmod +x /path/to/repository/hooks/pre-revprop-change

Now the remote SVN import should work without any problem.

And remember, our Subversion Hosting is already able to import your dump file.

Last Change: 2016-06-16
SVN Repository dump and restore
How do you like the article?
45 Currently 22 Ratings = 4star_rate


Thanks for this handy how to

head - 2014-02-21 at 18:59

I want to backup my tags/1.0 folder of repo-a and restore it into trunk folder of repo-b.
My problem is that when i use these commands my repo-b will be trunk/tags/1.0
How can I ommit tags/1.0????

Ali - 2017-08-12 at 15:01

Look up a tool called svrfiltereddump, written by Harald W. - that should solve your problem.
What you need to do is create a special dump using the the dump tool and then load it back into the new repo location with the parameters to renumber your revisions.

Palani - 2017-12-22 at 15:07

Excellent article useful to all the aspirants.

AWS training in hyderabad - 2020-11-16 at 09:08

This is a wonderful article, Given so much information in it, These type of articles keeps the user's interest in the website, and keep on sharing more ... good luck.

AWS training in hyderabad - 2021-01-28 at 09:04

Very informative. Thanks a lot for sharing

Best data science course training institute in hyderabad - 2021-04-09 at 10:36

Very useful information. Thanks for sharing

Top aws devops course training institute in hyderabad - 2021-05-25 at 14:33

Very useful information. Thanks for sharing

Top aws devops course training institute in hyderabad - 2021-05-26 at 15:05

commentLeave a comment