We were previously backing up our full SVN dump each night, but the repository has now become too large.

If I was willing to cut off the revision history at say 2 weeks, how would I go about making a batch script to perform this dump?

I realise svnadmin dump can take a revision range, but I'm not sure how to write a script to get the revision number corresponding to a time in the past, e.g. 14 days ago.


The help text doesn't show it, but you can specify a revision range using dates or a few keywords, the same as you can with the normal svn commands. To dump commits from the previous month up to the current HEAD:

svnadmin dump /path/to/repo/ -r {2011-05-20}:HEAD > /path/to/dumpfile

Bear in mind that this method means you need to ensure that your snapshots catch every revision and don't overlap, since the dump files don't contain explicit revision numbering information. The restoration method of svnadmin load will just replay and renumber your revisions if there's any missing or any overlap.

I should mention svnadmin hotcopy as a backup option, since they're much faster than dumps. (You can take regular, offline dumps from the hotcopy if text dumps are what you need).

  • Thanks, very helpful. Think I'm going to move to the hotcopy option too, can't remember why I rejected it before. – PLC Jun 20 '11 at 10:37
  • When I moved to hotcpy, the only cons I could see were that 1: the DB was a proprietary format instead of a plaintext dump, so potentially harder to recover from. (Though I was compressing the dums, anyway.) and 2: Restoration would require the same version of svn that you used to create the hotcopy (which I didn't see as being too hard to manage, since we didn't upgrade all that frequently.). The time savings were too big to ignore (backups were ~30 minutes instead of ~5 hours) – SmallClanger Jun 20 '11 at 10:59
  • Dumping a range of revisions like that actually doesn't work. See problems described here: serverfault.com/questions/895315/… It also seem to be extermely slow. – Nux Jun 4 '20 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.