How to Backup and Restore SVN Repository in Linux

Subversion is the popular version management system widely used for application developments. As a system administrator, you must know the importance of backups. So keep backup of your all svn repositories on local server as well as on remote system. This article will help you to backup and restore svn repository on Linux system through command line.

1. Backup Svn Repository

Subversion provides svnadmin utility for managing svn repositories. We can also take backup of svn repositories using svnadmin command.
$ svnadmin dump /var/www/svn/myrepo > /backup/svn/myrepo.dump   * Dumped revision 0. * Dumped revision 1. * Dumped revision 2. .... 

2. Backup SVN with Gzip Compression

We can also compressed backup with gzip and save disk space. Use the following command to backup svn repository and compress it using gzip command.
$ svnadmin dump /var/www/svn/myrepo | gzip -9 > /backup/svn/myrepo.dump.gz 

3. Restore (load) Svn Repository

Now if you are required to restore your svn repository from backup. Use the following example to restore repository from a backup file. For this example we are creating new repository to restore dump.
First create a new repository using create option.
$ svnadmin create /var/www/svn/mynewrepo 
Now restore backup to newly created repository using following command.
$ svnadmin load /var/www/svn/mynewrepo < /backup/svn/myrepo.dump    <<< Started new transaction, based on original revision 1      * adding path : svn-auth-screen.PNG ... done.      * adding path : template.txt ... done.  ------- Committed revision 1 >>>  <<< Started new transaction, based on original revision 2      * adding path : file1.txt ... done.      * adding path : file2.txt ... done.  ------- Committed revision 2 >>> 

Thanks for Visit Here

Comments