Use personal Amazon S3 account to backup Gmail using Ubuntu

3

2

As question, I have found online that backupify offer shifting from their S3 to user's personal S3, I have a backupify account but I can't find this options, besides, I don't prefer having my email being processed by somebody else.

Is it possible to use my own personal amazon s3 account to backup Gmail? Preferably as incremental backup, as I don't have to use too much of bandwidth to load redundant data back to S3.

I am using Ubuntu, so script is OK for me.

lokheart

Posted 2011-03-01T02:05:35.013

Reputation: 473

Did you ever try out my answer? – Geoff – 2012-12-13T14:36:01.030

Answers

1

Backup G-mail

One option is to use gmail-backup from gmail-backup.com. You can then backup all of your e-mail to [backupDirectory] like:

gmail-backup backup [backupDirectory] [emailAddress] [password]

Where [backupDirectory] is some folder where you'll keep a local copy and [emailAddress] and [password] are how you connect to your Google account. Note that you'll need to have imap enabled in your Gmail settings.

Incremental Backup:

Note that you will only be downloading new e-mails (See Incremental Backup). Each time you run the command, however, you will be checking every e-mail to see if it's new. To help decrease the overhead of looking over ancient e-mails consider adding a date, as in:

gmail-backup backup [backupDirectory] [emailAddress] [password] 20110101

Also note that it requires python2.5. These instructions may help you meet this requirement.

Backup to S3

One option is to use s3cdm (available in apt) from s3tools.org

s3cmd sync --delete-removed --skip-existing [backupDirectory] s3://[s3URL]

where [backupDirectory] is the same place you just downloaded all of your e-mail, and [s3URL] is the URL in your S3 account where you want to place it.

Be sure to take a look at the s3cmd intro page, to learn about first-time setup, and the s3cmd sync documentation page for more examples. It basically provides rsync-like functionality to S3.

Also, note that I've used --delete-removed here to delete (from S3) any e-mails that have been permanently deleted there.

Incremental Backup:

Note that the --skip-existing flag will ensure that you don't re-copy millions of old e-mails to S3.

Encryption

I'd like to suggest that you also use encfs (or some other encryption tool) for something like this. Sending plain-text copies of all of your e-mail to Amazon is not secure. If you use encfs you can then sync the encrypted copy instead, while still keeping the incremental backup goal.

Since you use Ubuntu, consider checking out this tutorial on folder encryption. If you follow their example, in our case you'd want to sync to S3 the folder called ~/encrypted (not ~/visible).

Geoff

Posted 2011-03-01T02:05:35.013

Reputation: 1 108