Replicating a remote SVN repository to a new server repository using svnsync
Here are some simple and straight-forward steps that you can take to backup, sync or otherwise copy the entire subversion repository from one server to another for any reason. In my case, I am in the process of reorganising my servers and I need to move the subversion repositories to a redundant setup from a dedicated single-hardware server. The following steps are not revolutionary or unique (there are many SVN manuals and sites detailing some version of these steps). I am documenting the process as I have run it to make life easier for the next person that just needs to replicate a live repository from one server to another.
I should note that in order to avoid unfaithful copies, you should suspend all modifications to the source repository while you do this to ensure that changes do not take place while you are sync'ing.
- Create a new repository on the destination server in a directory of your choicecd /some/path
mkdir newrepositoryplace
svnadmin create newrepositoryplace/reponame - To avoid having to type long paths, we will create a variable to carry the path to our new repositorymynewrepository=/some/path/newrepositoryplace/reponame
- Now, we need to prepare the new repository to receive new changesecho '#!/bin/sh' > $mynewrepository/hooks/pre-revprop-change
chmod +x $mynewrepository/hooks/pre-revprop-change - The we initialise the source destination and source repository pathssvnsync init file://$mynewrepository svn+ssh://username@myremoteserverdnsorip.com/home/me/pathtosvnrepos
- Begin the synching process - will run through all the revisions ever made to the source repo and mirror them to the new serversvnsync sync file://$mynewrepository
The last command will trigger a replication of each committed version from the source to the destination server repositories


