SVN backup and restore

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 > /backups/testrepo.dump

1.2 Gzip Created Dump

gzip -9 /path/to/reponame.dump


Real example
gzip -9 /backups/testrepo.dump

1.3 SVN Dump and Gzip Dump with One-liner

svnadmin dump /path/to/reponame | gzip -9 > /path/to/reponame.dump.gz

Real example

svnadmin dump /var/www/svn/testrepo | gzip -9 > /backups/testrepo.dump.gz

2. Restore (load) SVN (Subversion) repository

2.1 Unzip Dump File

gunzip /path/to/reponame.dump.gz
Real example
gunzip /backups/testrepo.dump.gz

2.2 Create Empty SVN (Subversion) Repository

svnadmin create /path/to/reponame
Real example
svnadmin create /var/www/svn/testrepo

2.3 Setup SVN (Subversion) Repository Permissions


chown -R svnuser:svngroup /path/to/reponame## If you use SELinux then remember also set security context ##
chcon -R -t httpd_sys_content_t /path/to/reponame
## Following enables commits over http ##
chcon -R -t httpd_sys_rw_content_t /path/to/reponame
Real example

chown -R apache:apache /var/www/svn/testrepo## Set security context ## 
chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
## Following enables commits over http ##
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo

2.4 Load Data to Repository from SVN (Subversion) Backup


svnadmin load /path/to/reponame < /path/to/reponame.dump
Real example
svnadmin load /var/www/svn/testrepo < /backups/testrepo.dump

3. Automatic SVN (Subversion) Repository Backups

3.1 Edit Crontab

crontab -e

3.2 Add SVN Dump Command to Crontab



@daily svnadmin dump /path/to/reponame > /path/to/reponame.dump## OR ##
@weekly 
svnadmin dump /path/to/reponame > /path/to/reponame.dump

Real example

@weekly svnadmin dump /var/www/svn/testrepo > /backups/testrepo.dump

3.3 More Advanced SVN Dump Example with Time and Date and Gzip
@daily svnadmin dump /path/to/reponame | gzip -9 > /path/to/reponame-$(date +"%Y-%m-%d-%T").dump.gz


Real example
@daily svnadmin dump /var/www/svn/testrepo | gzip -9 > /backups/testrepo-$(date +"%Y-%m-%d-%T").dump.gz

SVN backup and restore SVN backup and restore Reviewed by Unknown on October 30, 2017 Rating: 5

Scribe

http://feeds.feedburner.com/LinuxAndAws
Powered by Blogger.
X

Get Updates On

Linux Tutorial

AWS Tutorial

Devops Tutorial

We are going to send you our resources for free. To collect your copy at first, join our mailing list. So don't miss any updates, stay connected!