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

23 people found this page useful, what do you think?

Trackbacks

Trackback Address: 665/A6875C66E66782136EDF4E460535DCD4

Comments

On 05/28/2008 at 3:12:44 PM EDT 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 7:23:08 AM EDT 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 10:39:16 AM EDT 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/22/2009 at 1:50:21 AM EST JDStraughan wrote:
4
Added to TUTlist.com

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

On 03/16/2009 at 10:28:07 AM EDT 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 5:38:50 AM EDT 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.

On 09/22/2009 at 8:29:55 AM EDT Anonymous wrote:
8
Hi I am trying to move SVN repository to another server.(Vista) I followed the above procedure but Iam not able to do. In command prompt I typed the following command " svnadmin load C:\Desktop\Repository\ABC.bak < C:\Repositories\ABC Error Message: Access Denied"

Please Help

On 09/22/2009 at 10:01:44 AM EDT Pete Freitag wrote:
9
@Anonymous it looks like you have your backup file and restore location in the wrong order. It should be svnadmin load {restore.path} < {backup.file}

On 09/29/2009 at 5:19:26 PM EDT Simón wrote:
10
Thanks! I had to migrate from a newer version of subversion to an older one, and this saved my day :)

On 11/25/2009 at 2:58:54 PM EST Dave wrote:
11
Worked! Thanks.

On 11/25/2009 at 4:07:01 PM EST Eddie Monge wrote:
12
Don't forget to also update the clients with the location of the new repository so they won't commit to the old server.

On 05/21/2010 at 4:05:44 PM EDT Mahbub wrote:
13
"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" - That is not true in fact.

We keep 14 days of automatic SVN backup using hotcopy and tar. Today i moved from ubuntu 10.04 to Fedora Core 11 and restored the hotcopy exactly in the same location but different OS (of course), different SVN version. It worked without any problem.

Hotcopy doesn't give you verbose output but it's fast. So i use it more often than dump.

On 06/12/2010 at 3:07:50 AM EDT Kiran wrote:
14
Great tutorial. saved me a lot of time. Thanks a lot!

On 11/16/2010 at 7:15:05 PM EST Matt wrote:
15
I have a server running Subversion and SSH. My repos exist elsewhere on the network on a data server.

I want to move the Subversion server to a different SSH server. Is it safe to install subversion on the new server and give it the path to the already existing repositories on the data server?

Any advice would be great.

On 03/08/2011 at 3:51:05 PM EST Jason Gill wrote:
16
Thanks for the info. It was as easy as you made it sound.

On 06/28/2011 at 8:54:06 AM EDT tcpdump wrote:
17
hi pete,

nice stuff... made my life much easier :-)

tcpdump

On 08/13/2011 at 5:05:59 AM EDT Morten Trøjborg wrote:
18
Thanks alot. Worked perfectly...

On 08/22/2011 at 8:23:56 AM EDT Vishal Desai wrote:
19
Thank you so much for this tutorial. Just migrated my repositories to another newer server without any problems.

On 09/27/2011 at 6:49:42 AM EDT David J. wrote:
20
Excellent tutorial. You saved my day ! Thanks.

On 10/25/2011 at 6:29:06 AM EDT Fredrik wrote:
21
Great tutorlial Peter! Just one thing, when im trying to create the dump it saying: " Bad user name and password " ? Please anyone I need help, thanks again for the tutorial

On 11/25/2011 at 4:35:47 PM EST TeleNoise.de wrote:
22
Worked perfect! Saved my day.

On 04/24/2012 at 7:42:37 AM EDT umakanta wrote:
23
I just copied the repository from one machine to another and it worked. I can see/access the complete data from the new machine also. this is amaging , with out performing dump or hotcopy my work is done.

The apache and svn server versions were same in both the machine.

Can any one tell will it be create any issue in future

On 05/02/2012 at 9:40:37 AM EDT md wrote:
24
Thank you for the tutorial.

I am following these steps, but at the end when I goto http://localhost:3343/csvn/repo/list on new server, I do not see the imported project. Don't know what is wrong... Probably doing some silly mistake. Could somebody help please?

A) On original server create backup file (The console output is as follows)

C:\>svnadmin dump E:\svn\data\repositories\my_project_name > test_dump.svn_dump * Dumped revision 0. * Dumped revision 1. * Dumped revision 2. * Dumped revision 3. -----------------------------------

B) On new server create new SVN repository

D:\>svnadmin create d:\NEWSVN

D:\>svnadmin load d:\NEWSVN < test_dump.svn_dump <<< Started new transaction, based on original revision 1 * adding path : branches ... done. * adding path : tags ... done. * adding path : trunk ... done.

------- Committed revision 1 >>>

<<< Started new transaction, based on original revision 2 * adding path : my_project_name ... done.

------- Committed revision 2 >>>

<<< Started new transaction, based on original revision 3 * adding path : my_project_name/.classpath ... done. * adding path : my_project_name/.project ... done. * adding path : my_project_name/.settings ... done. * adding path : my_project_name/.settings/org.eclipse.jdt.core.prefs ... done. * adding path : my_project_name/src ... done.

------- Committed revision 3 >>>

D:\>

--------------------------------------------

On 05/31/2012 at 6:56:03 PM EDT Anon wrote:
25
You're a God among men.

On 09/17/2012 at 3:15:13 PM EDT paul wrote:
26
also found this useful: http://stackoverflow.com/questions/12061024/svn-load-mynewrepo-myoldrepo-dump-cant-open-file-mynewrepo-format

On 12/31/2012 at 2:45:56 PM EST Tom Peterson wrote:
27
Nice simple instructions on restoring from a dump file. Thanks.

On 02/17/2013 at 10:27:26 PM EST Patrick wrote:
28
Thanks, Pete, this is really helpful.

On 02/19/2013 at 12:22:12 PM EST Donnie wrote:
29
plz disregard last, I had a misconfigured conf.d file

Post a Comment




  



Spell Checker by Foundeo

Recent Entries



foundeo


did you hack my cf?