Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a Ubuntu(head-less) system that runs our SVN repository(ies). Would like to regularly back it up to a Windows share automatically. What should we do ? Any links/articles ? Any gotchas ?

How easy is it to restore from these backups ?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

$ svnadmin dump /path/to/repo | gzip > backup.gz

$ gunzip -c backup.gz | svnadmin load /path/to/repo

share|improve this answer

Tar it up, then use gvfs-copy to copy it over, or mount the share as CIFS, copy, and unmount.

share|improve this answer

Further to Rajat's anwswer, if your Ubuntu system has the space I would do a hotcopy first and then either dump the hotcopy or tar it up.

$ svnadmin hotcopy /path/to/repo /path/to/local/backup
$ svnadmin dump /path/to/local/backup | gzip > backup.gz
  or
$ tar czf backup-hotcopy.tgz /path/to/local/backup

Thus,

  • you have a local backup if the repo gets corrupted.
  • the backup can be done without any outages - it can be done whilst dev's are commiting to the database. (IIRC the dump command may not work cleanly on a live repo - but I can't find a definitive source on this after doing a quick search - someone correct me if I'm wrong or point to confirmation)
  • The local hotcopy will also include any hook scripts that you may have setup - whereas the dump will not.

However, the tar'd up hotcopy contains a repository in Linux format. This may cause issues if your Ubuntu box dies and you want to restore onto a Windows machine. (This one bit me once - we needed to restore quickly and a windows box was the only server available). This is not an issue with the dump variant. You'll need to create a working reposity somewhere first - but having done so the dump can be loaded without any care as to the underlying OS.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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