If you have a large Subversion repository and want to back it up using as few space as possible, use this command (replace repo
with your actual repository path):
svnadmin dump --deltas /repo |bzip2 |tee dump.bz2 | md5sum >dump.md5
Step by step:
-
The important part is
--deltas
, which uses a more CPU intense but more storage efficient delta method. -
bzip2
is slower thangzip
but compresses better. -
Now to another fun part:
tee
redirects the compressed data stream into the filedump.bz2
, but also writes the stream to stdout which in turn is redirected into the MD5 calculation tool.
To restore the repository, test checksum, create empty repository, restore backup:
md5sum -c dump.md5 <dump.bz2
svnadmin create newrepo
bzcat dump.bz2 | svnadmin load newrepo
Enjoy your compact and MD5 summed backup, and store dump.md5 and dump.bz2 somewhere really safe.