Subversion has been used as my project version control system for years. Backup and restore subversion data will be a critical issue. Here are three ways to create a full mirror of a Subvrsion repository:
- File Copy: treat the repository like any other filesystem and recursively copy it to the mirror location.
- Dump/Load: Use svnadmin dump and svnadmin load.
- Hotcopy: Use svnadmin hotcopy.
3 Ways to Backup Subversion Reviews
All these ways have their own advantage and disadvantage. In the following table, I will show the different between these 3 ways.
Method | Server Downtime | Replicates Configuration | Speed |
File Copy | Yes | Yes | Quickest |
Dump/Load | No | No | Slowest |
Hotcopy | No | Yes | Quick |
Backup subversion repository by copying
The only limitation of this backup way is the subversion system should be taken down when we are copying the repository to target. The command line of copy a subversion repository is
>cp -R path_of_repository path_of_destination
Backup subversion by svnadmin dump and load
Svnadmin dump is designed to create a portable repository dump. The resulting dumpfile can be loaded into a new Subversion repository – even if the new repository is using a different database backend, or even a different revision of Subverson. And you don’t need to take down the Subversion server when running the Svnadmin dump. This is the most common way to backup a Subversion repository. The command line looks like:
>svnadmin dump PATH_OF_REPOS > backup.dump >svnadmin load PATH_OF_MIRROR < backup.dump //this is comment >
Backup subversion by svnadmin hotcopy
The svnadmin hotcopy doesn’t require any server downtime, completes in minutes, and replicates server configuration and hoot scripts. The command line is:
svnadmin hotcopy path_of_repository path_of_destination
Restore svn repository from hotcopy
Hotcopy is just like a copy. So the final backup folder is mirror repository which you can use directly. If you want to restore repository from hotcopy backup, you can easily copy the backup files back to your repository location.
SVN Trouble Shoot
When I am running svnadmin dump
command, I get following error message:
svnadmin: Expected FS format between ‘1’ and ‘4’; found format ‘6’
It is because the svn and svnadmin version is too old. My current version is 1.6. I am going to the visualsvn.com and get the latest visual svn server. After I update the svn to 1.8, the problem is solved. You can using following command to get your svn and svnadmin version number.
>svn --version >svnadmin --version
Another problem about the svnadmin dump is it doesn’t work with url. If you are running following command, you will get error:
svnadmin: ‘http://projectname.googlecode.com/svn’ is an URL when it should be a path
One solution for it is create a local svn repository and synchronize with the remote server.
Hola una consulta y en donde se guardan el backup que se hace, creo se hace donde se ejecute el comando no es así???
Hi, I don’t know your language. Can you please type your question in English.
Thanks
Hello my query and En Donde backed ago That saved?
Hello my query and En Donde backed ago That saved?
Hi James, we have a huge subversion repository of 287 gb, that runs on apache.We need to migrate that to other server with different version of subversion.I have felt the svnadmin dump/load (even with gzip) takes lot of time.Would you suggest that i can take hotcopy, if so how much time would it take.Also, after the hotcopy is complete should i do an rsynch to new server and svnsynch? i basically want to avoid any downtime.Can you please recommend and provide the exact commands if possible.
Hello,
I am only using these commands for backing up my personal subversion repository.
How to restore backup which has taken by below command
svnadmin hotcopy /home/svn/repo1 /var/backup/repo1
The backup file is a mirror repository. If you want to restore your repository, please simply copy the backup repository back to your original repository.