backing up SVN repository on Ubuntu linux to a Windows share

Solution 1:

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

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

Solution 2:

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

Solution 3:

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.