I'd like to make a backup of my SVN repo using tar and ftp from a cronjob once a day. This is quite easy, but I would like to make sure there's no commit etc. running while the backup is made. While there are times of the day / night where this is highly unlikely, but I'd rather not rely on that, because if I'm already up at night in some crunch, the last thing I need is my SVN or my backups getting messed up.
I'm looking for some very simple but effective safeguard. It's OK if SVN clients get an error while the backup is running (it won't take that long). Should I use
I started posting this over at serverfault, but then decided that it is slightly closer to programming than to sysadmin, especially if hooks are involved. Feel free to move it if you think otherwise.
The theoretical way of doing a backup safely is to use the svnadmin hotcopy command (more details here). It basically does a copy of one repository (not a dump, a copy), taking care to block all the operations during that time.
This operation is quite fast, so I shouldn't think any client would have an error, they may experience some delay though (depending on the server load and so on).
You can find an example of script on the Apache subversion project website.
If you do a dump, besides the huge time it takes, you won't be sure it will done in an atomic way. Dumps are useful to
Before opting for a dump, should you prefer that anyway, I encourage you to do the operation manually before, to make sure it is not too long. Make sure also to compress those files, which are much bigger than a repository (hotcopy) - the latter is very well compressed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With