Migrating bdb svn repositories from one version to another and to fsfs

Today I had to work with a really old svn repository again, which was still in the old bdb format (not in the newer and recommended fsfs one). This caused quite some problems, like, um... you cannot checkout, update, or commit anything.

$ svn co file:///path/to/myrepo
svn: Unable to open an ra_local session to URL
svn: Unable to open repository 'file:///path/to/myrepo'
svn: Berkeley DB error for filesystem '/path/to/myrepo/db' while opening environment:
svn: DB_VERSION_MISMATCH: Database environment version mismatch
svn: bdb: Program version 4.6 doesn't match environment version 4.4

A quick search revealed that this is bug #342508, a solution is/was supposedly mentioned in /usr/share/doc/subversion/README.db4.3 (which does no longer exist in the Debian unstable package). Luckily this blogpost has some details.

So, the short HOWTO for upgrading an svn repository of one Berkeley DB version to another one is:

$ cd /path/to/myrepo/db
$ db4.4_checkpoint -1
$ db4.4_recover
$ db4.4_archive
$ svnlook youngest ..
$ db4.6_archive -d

In this case I upgraded from 4.4 to 4.6 (do "apt-get install db4.4-util db4.6-util" if necessary).

While I was at it, I also switched the repository to the fsfs format then:

$ svnadmin dump /path/to/myrepo > myrepo.dump
$ mv /path/to/myrepo /path/to/myrepo.bak
$ svnadmin create --fs-type fsfs /path/to/myrepo
$ svnadmin load /path/to/myrepo < myrepo.dump

Maybe this is helpful for some other people out there.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi,It's also possible to


It's also possible to dump the repository into portable format and recover it.

I used this to relocate repositories from RHEL4 to RHEL5 where the bdb format had changed.

svnadmin dump repos >repos.dump
mv repos repos.old
# copy repos.dump to the new host, and continue there...
svnadmin create repos
svnadmin load repos

like a charm

you saved my day, it worked perfectly.


svnadmin recover

This worked perfectly fine for me !:

svnadmin recover /path/to/your/svn/repo

You have encountered a real

You have encountered a real problem of the dbd format because it is very very old format and it takes some real hardwork to overcome it.

repository upgrade

I have the same problem as you describe. However, when I try to do step 1 above:
db4.4_checkpoint -1

I get :
db4.4_checkpoint: munmap: Invalid argument
Segmentation fault

Any pointers on what is going wrong?

thanks very much !!!

I recently upgraded my Etch system to Lenny, this system had initially been sarge.
In sarge Subversion repositories could only (or by default) be created as BDB.

So I encountered this bug and your post saved me many hours.

Thanks very much !!!!

you da man! it worked

you da man! it worked perfectly and easily. God how I wish software these days all did that.

Vielen Dank!

A shorter way than five bsddb low-level commands

svnadmin recover /path/to/your/svn/repo

According to this email (also, it worked for me).


Thank you very much for posting this instruction! I got the same problem with an old subversion repository and found your page by using Google.

You saved me a lot of time and trouble, thanks again!



Frankly, the best SVN conversion tool I have come across...

is git-svn. It is _so_ painless to migrate from a SVN repository to a Git one! Even if you prefer to work (as I do) the old centralized way, working with Git is so much faster for basically everything that... It is hard to understand how I didn't change earlier on!


Yeah, git is very nice, but I won't be able to get rid of all svn repositories anytime soon. But I do use git for new projects myself, indeed.


db4.4-util is not currently in lenny

Though it is in unstable. dpkg -i on manually downloaded debs from etch seem to work fine, though.