With Subversion now moved to my new QNAP, I need to start worrying about proper operational procedures under the new environment. One important bit is worrying about the Backup.
My repositories have grown rather large (at least some of them) and a daily full dump of the data is out of question. Instead, I am looking for a method that allows me one full dump, followed by a set of incremental dumps, created each time data is committed.
For the moment, let’s just assume that I will place the incremental backups in a dedicated directory on my RAID 1 Mirror (later-on, it might be an external HDD attached to the QNAP).
The implementation is easier than you might think – especially when using the already available SVN Hooks.
The one we are interested in is the post-commit hook. Simply copy the post-commit.tmpl file to a file names post-commit (without extension). Then make the file “executable”.
chmod +x post-commit
Now edit the file, for example using nano. This is what you want to have in the file:
When you now commit to the repository, it will automatically create the backup directory if it does not exist and perform an incremental backup of the committed revision into this directory.
Note that the hook is repository-specific! You can copy the file to a different repository (again, into the hooks directory) and all you need to do is rename the PROJECT variable to make sure to commit into a different target location.
Worse comes to worst, you can now restore your Subversion Repository from a baseline (full dump) and the incremental revisions.