How to migrate an SVN repository from Dreamhost to another server
For a while I’ve had a number of subversion repositories on Dreamhost for source control. Much credit to Dreamhost, it’s a doddle to setup and I’ve never had any reliability issues. The problem with having a remote SVN though is that it’s a bit slow. So, as most of my development is done in the office, I decided to move the repositories to a local server.
I guessed this would be fairly easy and, more or less, it was. The only thing that really held me up was that although the Dreamhost documentation is good on subversion, it doesn’t seem to mention how to move a repository off.
Here’s what you need to do:
Assumptions:
- You already have SVN setup on the target server and have setup an empty repository to migrate your existing Dreamhost repository to. It will need to be a native filesystem repo (although there are ways around this). If you don’t have it setup already, you can find lots of info by Googling it. If you are running SVN on a windows server, I was a bit dubious at first, but I would recommend Visual SVN Server - it’s a 2minute setup process.
- You have an SSH client. If you’re using a Mac, happy days. If you’re using a PC grab a client such as PuTTY.
First the export:
Let’s get cracking.
- First you need to make sure your main Dreamhost user has SSH access. Login to your Dreamhost account and go to Users / Manage Users and then edit your main user. Under User Account Type to Shell account as shown below:|

- Now, open up your SSH client. On a Mac just bring up the terminal (Applications / Utilities / Terminal).
- Login to Dreamhost using the command:
ssh <user>@domain.com
Obviously replace <user> with the username of the user in step 1. You will then be prompted for a password. Enter this and hit return.
- Now you need to do a dump of your repository. Don’t worry, it won’t actually break the existing repository (I accept no liability on this!), it just exports all of the revisions to a single file. Enter the command:
svnadmin dump /home/<user>/svn/<repository> > <repository>.dumpfile
Make sure you replace <user> with the username in step 1 and <repository> with the name of your SVN repository. You might need to check what this is in the Dreamhost panel if you don’t know it.
- FTP in to your Dreamhost account and find the file <repository>.dumpfile sitting in the root of your home directory. Mine was about 130meg in size so you might have time to make a cuppa or write a blog post while it downloads.
Now the import:
- Open up a command prompt/shell.
- Enter the command:
svnadmin load c:\myrepos\repo < c:\mydownloads\<repo>.dumpfile
The first part is the path to your new repository. Replace this with the correct path according to your server/OS. The second part after the < is the path to where you downloaded your backed up repository in the previous step 5.
The import can take a while to replay all of the revisions depending on the size of it, but once it’s done, you should have a fully accessible repository with all the history.
It kinda goes without saying but you can use the same process locally to backup your new repository and then perhaps FTP the file off somewhere safe as an off-site backup. You can also do incremental exports but I’ll leave you to look at the docs for the svnadmin dump command to find out about that.

Comments
Aaron Saray
said on 18 March 2008Hey - nice - but I was thinking - perhaps you should make this more generic - leave Dreamhost in the title for a keyword catch - but add on something like “or any other host.” The process would be the same really for any host with shell access, no?
-aaron
Tom
said on 18 March 2008Hi Aaron, thanks for the comment. Yes indeed, you’re quite right. This would work on any account you could get shell access to. I specifically did it for dreamhost though as their documentation was a bit lacking in this area and it took me a bit of fiddling to get paths right etc.
Tom
said on 19 March 2008Just a quick update… Mark wanted me to ‘Fix’ some directories on his computer. I assumed they were still mapped to the previous server but when I checked they were correct and had already been switched. We were getting a very strange MKACTIVITY 403 forbidden error message.
After a bit of Googling the solution was very simple, the name of the repository is case sensitve it seems (or at least when using Tortoise SVN, I didn’t try without). Here is more info on the subject:
http://www.alagad.com/go/blog-entry/subversion-mkactivity-and-403-forbidden-headaches
Add a comment