问题
I often hear that having an SVN repository doesn't cancel need for backups.
How is such backup done? I mean the repository will inflate over time, won't it? So do I back it up as a whole every time or what do I do?
What's the easiest way to do such backups?
回答1:
I've used svnadmin with hotcopy.
svnadmin hotcopy repopath backupdestination
You can also use the svnadmin dump command.
回答2:
You could use svnadmin dump. For example, to create a compressed backup file in Linux run:
svnadmin dump -q /path/to/repo | bzip2 -9 > repo_backup.bz2
To restore a backup use svnadmin load:
svnadmin create /path/to/newrepo
bzip2 -cd repo_backup.bz2 | svnadmin load /path/to/newrepo
See also Repository data migration using svnadmin in the SVN Book.
回答3:
I have made use of the post commit hook to make an incremental backup:
REM Backup of Revision
MD "C:\SVN Backup\Incremental\%TYPE%"
set TYPE=2020
set ADMIN="C:\Program Files (x86)\WANdisco\uberSVN\bin\svnadmin.exe"
set ZIP="C:\Program Files\7-Zip\7z.exe"
%ADMIN% dump %REPOS% -r %REV% --incremental | %ZIP% a -si "C:\SVN Backup\Incremental\%TYPE%\%2.7z" -mmt -mx9
In addition to the incremental dump, I have a weekly batch file that runs that does a full dump. A little overkill, but all the dump files are zipped with the 7 Zip command line utility. Thereafter it is sync'd to our usual backup medium.
EDIT - Updated the code with the latest where I am zipping the dump files with the 7 Zip command line utility to save some space.
回答4:
Just copy and compress the whole repository folder, that'll allow you to easily get back to different points in time. Of course, you have to make sure not to do it while the repository is being used or god knows what might happen :)
On Windows you could use VSS to make sure you take a consistent backup or take the backup at night when it isn't being used.
Alternatively, check this similar question or that blog post.
回答5:
I just zip the repository once a week and copy the zip file to a different storage location.
来源:https://stackoverflow.com/questions/5500813/how-to-backup-svn-repository