Saturday, 9 January 2010

Cheap remote backup solution

After reading the madness of what happened to Phil Haack a few weeks ago and a few other people who had VPS’ running on the same machine after a physical hard drive failure everyone on the box (so it seemed) realised that they didn’t have much, if any, backup solution in place. This got me thinking …

There are a number of remote backup solutions for remote servers but they cost money which at the current time I don’t have, and most people don’t have due to the current economical climate. So was checking my email the other day and scrolled to the bottom of the page and noticed that I was only using a small amount of the my gmail account storage. It got me thinking that there was a plug in you could get to use your gmail account a remote storage / mapped network drive. This could be the reliable backup solution I’m looking for.

After doing a bit of Googling about to see if there was anything out there before I set down to write my own solution to this problem I found backup2Gmail on Code Project. Once I realised that you could run this from a command line then I was on to a winner.

So the backup bat file goes along the lines of:

Backup the svn respository using svnadmin to a backup folder (c:\backup\svn)

Checkout the latest code from the repository to a folder in the backup folder (c:\backup\code)

Run the backup 2 gmail command line to backup the c:\backup folder. It then zips it up and sends it to my account.

And that’s it. Put all that into a bat file, put some error checking in to make sure the dirs which are required are there at the beginner, removed at the end etc. and then set it as a scheduled task for some crazy time early in the day (currently set at 3am).

Hope this helps someone else in the future to avoid the heart ache of server failure.

No comments: