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 >...

28 comments on “SVN (Subversion) Backup and Restore - Comment Page: 1

1 2
    1. Thanks JR! This is very nice guide!

      Reply
    2. 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”

      Reply
      • Hi softboxkid,

        Thanks, you are totally right! I fixed this guide! :)

        Reply
    3. 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`

      Reply
      • Hi felipe,

        Excellent note! You are totally right! I fixed this.

        Reply
    4. Hi JR,

      Could you add the “one line” command to load directly the dump.gz file in SVN repository?

      thanks,
      Yannick

      Reply
      • Hi yannick,

        Do you just mean something like following:

        
        gunzip /backups/testrepo.dump.gz && svnadmin create /var/www/svn/testrepo && chown -R apache:apache /var/www/svn/testrepo && svnadmin load /var/www/svn/testrepo < /backups/testrepo.dump
        

        This is just example without setting SELinux security context.

        Reply
    5. 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

      Reply
      • Hi Shrihari,

        This is actually Linux / Unix guide, but I quickly checked this and looks like Windows load syntax is following:

        
        svnadmin load D:\SVNRepo\TestParent\testnew > test.dump
        

        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.

        Reply
    6. Great guide. Can you include a section on how to migrate a repository from one SVN server to another? Can backup and restore work?

      Reply
      • 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…

        Reply
        • A bit late but thanks for replying. your guide helped.

          Reply
          • my ‘thanks’ was late, not your reply. :)

            Reply
    7. 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…..

      Reply
    8. 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.

      Reply
      • Hi John,

        You can use incremental option, like:

        
        svnadmin dump --incremental /path/to/reponame > /path/to/reponame.dump
        
        Reply
    9. Thanks a lot for this howto step by step.

      Very usefull :)

      Reply
    10. Cool examples! Just what i needed :)

      Reply
    11. 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?

      Reply
    12. 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?

      Reply
      • 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.

        Reply
    13. 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?

      Reply
      • 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.

        Reply
    14. 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 {} \;

      Reply
    15. 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 ?

      Reply
1 2

Leave a Reply to JR Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close