Now that ownCloud has a desktop syncing client, creating reduntant local/remote file systems is easier than ever!
But, perhaps now that you've gotten a tast of backups and redundancy you're reminded that your web servers, your Mac, your EC2 (to a local copy of course) instances and etc. don't have an "ownCloud" or drop box to backup to.
Local servers should be backed up remotely, and remote servers should be backed up locally. Redundancy is your friend in case Amazon explodes or your house catches on fire...you're good to go!
S3
For this setup we're going to assume that Amazon is indeed going to be fairly stable and use their s3 file storage system. It's cheap, reliable and easy to work with.
rsync
If backups are old hat (but perhaps s3 isn't) then you're familiar with rsync. rsync is a great command line tool which makes incremental and smart synchronization between file systems on unix machines (and there's some windows ports).
But rsync doesn't work directly with s3
sad...
duplicity
Luckily, these smart guys made an rsync like tool which DOES work with s3 (and a host of other file storage services). http://duplicity.nongnu.org/
Using this guide http://icelab.com.au/articles/easy-server-backups-to-amazon-s3-with-duplicity/ we can see that it's quite easy to create a crontabbed backup script.
Here's the code I ended up using for my script.
#!/bin/bash
export PASSPHRASE=your_gpg_passphrase
export AWS_ACCESS_KEY_ID=your_s3_access_key
export AWS_SECRET_ACCESS_KEY=your_s3_secret
export MYSQL_PASSWORD=your_mysql_password
mysqldump -h localhost -u backup_user -p${MYSQL_PASSWORD} --all-databases | gzip > /var/dbdumps/AllDB.sql
duplicity --include /var/www --include /home/usernames --include /var/dbdumps --exclude "**" --full-if-older-than 30D / s3+http://com.mycorp.myhost.backup
Crontab
Then after making it exectuable I added a line to my crontab (crontab -e)
0 0 * * * /path/to/backupScript.sh > /path/to/backupScript.sh.out
and bam... every night we have a backup to my s3, and every 30 days I get a full backup.
I'll report an exact cost... but whatever the cost my mind is now at rest, and that's worth a considerable amount!
Remote to Local
Last supposing you have some remote servers that you want to synchronize locally simply modify script to use ssh, scp or sftp:
duplicity --include /var/www --include /home/usernames --include /var/dbdumps --exclude "**" --full-if-older-than 30D / sftp://username@localaddress/location
That's easy!








