SVN (Subversion) Backup and Restore - Comment Page: 1
This is quick guide, howto Backup (dump) and Restore (load) SVN (Subversion) repository on Linux. This is actually very simple and important task. SVN backup and restore is useful when you want to move your repos to new server or you need to recover your data. I assume here that you have Subversion (SVN) installed and you have existing repositories. If you installed and created testrepo with earlier guide then you can check real examples.
[inttf_post_ad1]
1. Backup (dump) SVN (Subversion) repository
1.1 Create Dump from SVN (Subversion) repository
svnadmin dump /path/to/reponame > /path/to/reponame.dump
Real example
svnadmin dump /var/www/svn/testrepo >...
Thanks JR! This is very nice guide!
Thanks for the info. But you forgot to put .gz at the end of file in steps “2.1 Unzip Dump File” and “1.3 SVN Dump and Gzip Dump with One-liner”
Hi softboxkid,
Thanks, you are totally right! I fixed this guide! :)
the cron jobs need to escape the % character, like this
`@daily svnadmin dump /var/www/svn/testrepo | gzip -9 > /backups/testrepo-$(date +”\%Y-\%m-\%d-\%T”).dump.gz`
Hi felipe,
Excellent note! You are totally right! I fixed this.
Hi JR,
Could you add the “one line” command to load directly the dump.gz file in SVN repository?
thanks,
Yannick
Hi yannick,
Do you just mean something like following:
This is just example without setting SELinux security context.
Step 1: I have created dump file as:
svnadmin dump D:\SVNRepo\Test > Test.dump
Step 2: Created Ne Repo as:
svnadmin create D:\SVNRepo\TestParent
Step 3: I want to load dump file in sub directory “TestNew” in D:\SVNRepo\TestParent
I’m tried as:
svnadmin load –parent-dir D:\SVNRepo\TestParent\testnew D:\SVNRepo\TestParent < test.dump
but not successful
How to do this? please provide example
Thanks in advance….
Shrihari
Hi Shrihari,
This is actually Linux / Unix guide, but I quickly checked this and looks like Windows load syntax is following:
But before this, make sure that you backup your dump or test this on test environment, because I can’t verify is this working on Windows.
Great guide. Can you include a section on how to migrate a repository from one SVN server to another? Can backup and restore work?
Hi khalid,
Yes, backup and restore should work when you migrate a repository from server to another. One good thing is that, you can be exactly sure that new server works as you wish before you change anything on old server…
A bit late but thanks for replying. your guide helped.
my ‘thanks’ was late, not your reply. :)
You guys write really really nice guides with detailed explanation…I solved lot of issues following your tutorials…99.9% of your tutorials worked perfect for me…good job….Thanks a lot…Keep it up…..
Question about automatic backups: could you make them incremental so everytime a backups has to be performed you don’t need to store again the whoooooooooooooooole repository? :-)
By the way, simple and effective guide.
Hi John,
You can use incremental option, like:
Thanks a lot for this howto step by step.
Very usefull :)
Cool examples! Just what i needed :)
Hi
first thanks for all the guides, very usefull.
Here is my problem: My repo has 12000 revisions. I would like to create a new Repositorie from a backup which contains only a range of the original, from rev. 8000 to HEAD.
My question, how can i do that?
what about dump size? hdd 25GB, repo 10GB can i dump? becouse dump without –deltas option will increase size!…
what repo % will be dump without –deltas, and will all your commands work the same with this option?
how dump/load to remote server? via netcat?
Hi asd,
You can use –deltas with these commands to make dumps smaller, this is CPU heavy task, but maybe worth it, if you have 10GB repo.
Dump size depends on totally repo content, if you have binary data in your repo, then it’s same size on dump and if you have plain text, then it’s compressed nicely.
If you want sync with remote server, then you could use svnsync. Or, if you want just dump to remote server, then netcat works too.
Nice article. Props ;)
However, I am thinking about sense of making such dumps if you have svn mirror configured. What is your opinion? Is dump needed whan you still have a mirror server?
Hi piotr and thanks,
SVN mirror is excellent if you have another server down, but if something really bad happen and your changes are mirrored to your another server, then dumps/backups are always very important.
Just like replicated databases, it’s very nice until someone drop your tables or databases and all changes are replicated to all nodes. It’s not possible to restore your db without dumps/backups.
How can I confirm my svnadmin dump executed without any warning or error messages. Is there any status checks available for this command, can you please help me to find a solution.
while read x ; do
svnadmin dump /www/svn/$
{x} | gzip -9 > /svn_backups/${x}
_`date +%d-%m-%Y`.dump.gz
done<repofile
find /svn_backups/ -maxdepth 1 -mtime +7 -name "*.dump.gz" -exec rm -f {} \;
I have some question Please help me to resolve .
1:How to delete svn user ?
2:How to change password of svn user ?
3:How to disable svn user ?
4:How to check that how many user there are in svn ?