views:

2035

answers:

5

I have a server that hosts my Subversion code base. That server is currently a Server 2003 box, and my IT admin wants to update it to Server 2008.

This means that I'm going to need to move my Subversion repository while the server gets built up and was wondering what the best practices are for moving the repository to a new server.

It seems like looking online they recommended way is to use:

svnadmin dump /path/to/repository > repository-name.dmp

and then use:

svnadmin create repository-name
svnadmin load repository-name< repository-name.dmp

To import the repository.

Does anyone have opinions on this, or does the method above seem like the best approach.

Thanks.

+1  A: 

If you are using the File System type repository, you can just literally take the folder containing your repository and move it. If you are changing servers, then chances are you will need to change the location that your local working directory looks for the repository by using the 'Relocate' command.

NerdFury
+8  A: 

Yes, dumping and loading the repository is a way to go. Copying the repository folder directly is viable option if and only if you are certain nobody will be accessing the repository while the copy process is in progress (or you can do a "hot copy" of the repository, which can handle these cases in a safe manner).

You will also need to either re-checkout all your working copies, or use the svn switch command, which merely rewrites URLs. A more convenient way is to use TortoiseSVN's Relocate command, which reduces the risk of making a mistake during the relocation process.

petr k.
Thanks,Actually, it should be good with the relocate because the server it's moving to will be the same server IP as where it currently lives.
Ryan Smith
Thanks, I struggled a little with direct copy because I didn't have my SVNServe root set correctly, but once I did it seems like the direct copy worked great. Thanks.
Ryan Smith
+5  A: 

My restore scripts is like this:

svnadmin create repository-name --fs-type fsfs
svnadmin load   repository-name --force-uuid < repository-name.dmp

First line ensures the repository uses the FSFS backend (which is recommended by many sources, including this one: How FSFS is Better, and AFAIK newer versions of Subversion use it as default).

The second lines keeps the UUID of the repository, for an easier transition (without --force-uuid switch, the working copy relocation will fail).

Some links:

alexandrul
A: 

Ryan, what you posted above is how I have done it before. Very similar to backing up a database.

+2  A: 

You can also use svnsync to move the repository; that way you can transfer all the data without the need to take the 'old' repository down. This is also the only way I know of to get your data from hosted environments, where you don't have shell access or access to dumping the repository.

Sander Rijken