How to Backup and Restore SVN Repository in Linux

 

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

1. Backup SVN repository

Subversion provides the svnadmin tool for managing SVN repositories. We can also backup the SVN repository using the 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 use gzip

Compress backups and save disk space. Use below command to backup svn repository and compress using gzip command.

 

$ svnadmin dump/var/www/svn/myrepo | gzip -9>/backup/svn/myrepo.dump.gz

 

 

3. Restore (load) the SVN repository

Now if you need to restore your svn repository from backup. Use the following example to restore the repository from the backup file. In this example, we are creating a new repository to restore the dump. First create a new repository with the option to create.

$ svnadmin create / var / www / svn / mynewrepo

Now restore the backup to the newly created repository using the following command.

$ svnadmin load /var/www/svn/mynewrepo </backup/svn/myrepo.dump<<<Startednew transaction, based on original revision 1* adding path : svn-auth-screen.PNG ...done.* adding path :template.txt ...done.-------Committed revision 1>>><<<Startednew transaction, based on original revision 2* adding path : file1.txt ...done.* adding path : file2.txt ...done.-------Committed revision 2>>>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326228597&siteId=291194637