pf » Moving a Subversion Repository to Another Server

Moving a Subversion Repository to Another Server

misc

Moving a subversion repository from one server to another, while still preserving all your version history may seam like a daunting task, but fortunately it's not too difficult.

I recently had to move a subversion (svn) repository to another server. The repository was on a Windows server and had to be moved to a Linux server.

Step 1: Backup your old Repository

The first thing you need when moving from one server to another is a dump of your subversion repository. Hopefully you are already creating dump's with a backup script, but if not here's how you can create a subversion dump file:

svnadmin dump /path/to/repository > repo_name.svn_dump

The dump file contains all the revisions you have ever made to your svn repository, so it will probably be quite large (it even includes files you may have deleted in a previous revision).

Step 2: Create the new Repository

Now, simply transfer the dump file on to your new subversion server, and create an empty repository:

svnadmin create /path/to/repository

Step 3: Import your old repository into the new one

Next import your dump file:

svnadmin load /path/to/repository < repo_name.svn_dump

You may want to force subversion to use the same UUID for the new repository as the old repository. To do this add --force-uuid to your svnadmin load command. In my case I wanted to do this. If you have already loaded your repository, there is a way to set the UUID at a later date, check the docs.

That's it, you now have a replica of your old repository on your new server.

FAQ's

What if someone committed a new revision to the old server during installation?

You can easily import the new revision, by creating an incremental dump on the old server:

svnadmin dump --incremental -r 1234 /path/to/repository > rev1234.svn_dump

Now to import that revision on your new server:

svnadmin load /path/to/repository < rev1234.svn_dump

Can't I just use a hotcopy to restore the repository?

It depends, hotcopies created with svnadmin hotcopy must be moved to a server with identical setup. You should have the same version of subversion installed on both servers, same operating system, etc.

Subversion dumps are designed to work with different versions of subversion, and are just more flexible. Hotcopies are handy to have, but I recommend creating both hotcopies and dumps as part of your backup plan.



Related Entries
10 people found this page useful, what do you think?

WAF for CF
Trackback Address: 665/A6875C66E66782136EDF4E460535DCD4
On 05/28/2008 at 1:12:44 PM MDT WayneJ wrote:
1
Howdy! Great tutorial, I planned on using it, but here's something I wasn't expecting..

I'm moving our site over to a new server and when I copied everything over, without doing anything else, SVN appears to be working. Perfectly. Any idea why this would happen?

On 08/21/2008 at 5:23:08 AM MDT Hatem Jaber wrote:
2
This is great, thank you Peter!

I'm moving from a small server to a larger server and one of the things that is being moved is SVN. I never done this before, but your instructions are clear and will make it easy for me.

Thanks again!

On 10/01/2008 at 8:39:16 AM MDT Peter Pilgrim wrote:
3
Fanatastic it worked like a dream. Moving from a workstation constrained local subversion on Windows XP Professional to a Subversion running on Solaris 8.

The biggest headache was compiling Subversion 1.5 on Solaris 8! Your instructions are a doddle in comparison.

On 02/21/2009 at 11:50:21 PM MST JDStraughan wrote:
4
Added to TUTlist.com

On 02/24/2009 at 7:56:13 AM MST Rabiek wrote:
5
Thanks for this tutorial. worked like a charm.

On 03/16/2009 at 8:28:07 AM MST Jawdy wrote:
6
Perfect! We needed to move our SVN repo from old and small server to new and large one - and having only ever used the client side stuff, I was a little nervous about doing the move. Your instructions were simple to follow, well explained and worked like a charm.

Thanks so much!

On 03/18/2009 at 3:38:50 AM MST velmurugan wrote:
7
Hi,

i am getting below the error.

Berkeley DB error for filesystem E:/SubversionRepository/db while opening 'nodes' table:No such file or directory.

How to fix this.please help me.

Thanks, Velmurugan.




  



Spell Checker by Foundeo





Subscribe to my RSS Feed: solosub RSS
Tags