Backing Up with Virtualmin and S3

Virtualmin is a great open source server management tool. In fact, its what I use for my hosting. Amazon S3 is a great, affordable online storage service. What do you get when you combine them? A great way to back up your servers.

Virtualmin has had support for local and remote backups for some time now, but the idea of weekly 8GB FTP sessions to my home server doesn’t seem so grand (it would interrupt the Linux ISO torrents). So I signed up with S3, and for less than the cost of a egg mcmuffin, I can keep 4 weeks of full system backups available for restore at a moments notice.

This guide assumes you’ve got Virtualmin Pro (not sure if the free version does S3 – it does, give it a try!), and an active S3 account.

Login to Virtualmin, and open Scheduled Backups under the Backup menu. If you don’t have any backups currently (shame on you!), it’ll drop you right to the Create screen. Most of the options should require no explanation, until you get to the Destination section.

Amazon S3 KeysSelect Amazon S3 Bucket. Now, you’ll need a couple pieces of info here. In another tab, login to S3, and select Access Identifiers under Your Account. You’ll need both the Access Key ID and Secret Access Keys. Copy and paste these into the appropriate fields in the Virtualmin backup config.

If you’re looking to do age-based backups, which will let you automatically rotate backups after they are a certain age, you will need to enable strftime formatting. Set the directory S3 bucket name to something like %d-%m-%Y, which will create folders named 03-06-2009 for example. If you don’t use a date in your folder name, backups will not rotate. Your setting should look something like this:

S3 Backup Config

Set your backup schedule (daily, weekly, monthly) and retention in the last section, and save your schedule. You might want to run it once right off the bat, to make sure nothing errors out on you. A full backup for Smash takes about 3 hours, but I think that’s somewhat CPU limited. My upload speed to S3 was about 12Mbps.

The great thing about backing up to S3 is that it makes restoring a snap. Just enter your S3 info into Virtualmin’s restore screen, enter the date you’d like to restore to, and let it go. It will pull the backup details from S3, then let you pick and choose which services you’d like to restore, so you don’t need to redownload the whole backup if you don’t need to.