It’s a neat little program I just recently discovered that lets you backup and restore your Gmail account along with your chat logs. It’s open source, can run on Mac, Windows and Linux. It’s really robust, prone to network/IMAP errors and fast. So far I used fetchmail to backup my Gmail emails, but it was slow and painful. One of great features of GMVault is, that you can cancel it any time you want and continue from that point some other time. Another thing that’s great is that it provides you export functionality, so you can visualize your backed up emails in thunderbird or dovecot clients. Not everything is great though. For instance, it can’t backup your calendar data, also it does have minor bugs like IMAP Abort problems, but hey, it’s open source and it’s beta… can’t complain too much if you need to make a workaround or 2 to make it work smoothly. Don’t worry, I will show you workaround for IMAP Abort issue at the end of this blog post. So, let’s just get to work.
Download latest version of GMVault from their official website. Over here: http://gmvault.org/download.html (At the time of this writting current version for Linux was: gmvault-v1.8.1-beta.)
tar -zxvf gmvault-v1.8.1-beta-src.tar.gz
If you get error like this: ImportError: No module named setuptools
Just install python setup tools. In my CentOS it’s simple as:
yum install python-setuptools
You might need to install latest distribute also, to make installation go smoothly.
easy_install -U distribute
Finally install GMVault.
python setup.py install
You should be aware of few things. First of all, in order for GMVault to work correctly, you need to be able to see All Mail through IMAP. To enable it, go to: Settings->Labels->All Mail and tick a checkbox there.
Once we have this, let’s just backup already…
gmvault sync --no-compression --passwd [email protected]
Use gmvault-db located in /home/myuser/gmvault-db.
Activate Gmvault db cleaning.
Authentication performed with Gmail password.
Please enter gmail password for [email protected] and press ENTER: [At this point provide your password for your Gmail account]
Connect to Gmail server.
No Storage DB in /home/myuser/gmvault-db. Create it.
Disable compression when storing emails.
Start synchronization (2014-12-12T23h38m53s).
Start emails synchronization.
2695 emails to be fetched.
Process email num 0 (imap_id:4) from 2011-12.
Process email num 1 (imap_id:5) from 2011-12.
Process email num 2 (imap_id:6) from 2011-12.
Process email num 3 (imap_id:7) from 2012-01.
Process email num 4 (imap_id:8) from 2012-01.
CRTL^C. Stop all operations.
I stopped sync at this point with CTRL+C and restarted it with the same command, just to show you how easy it is. Here’s tail of the completed sync:
(Note: I have Gmail chat disabled, that’s why it couldn’t backup it.)
Process email num 2692 (imap_id:4969) from 2014-12.
Process email num 2693 (imap_id:4970) from 2014-12.
Process email num 2694 (imap_id:4607) from 2014-11.
Emails synchronisation operation performed in 4m 54s.
Start chats synchronization.
Cannot find 'Chats' folder on Gmail Server. If you wish to backup your chats, look at the documentation to see how to configure your Gmail account.
chats synchronisation operation performed in less than a second.
Look for emails/chats that are in the Gmvault db but not in Gmail servers anymore.
Read all gmail ids from the Gmvault db. It might take a bit of time ...
Found 2695 email(s) in the Gmvault db.
Call Gmail to check the stored emails against the Gmail emails ids and see which ones have been deleted.
This might take a few minutes ...
Will delete 0 email(s) from gmvault db.
Chats IMAP Directory not visible on Gmail. Ignore deletion of chats.
Deletion checkup done in 1s.
Sync operation performed in 4m 55s.
Number of reconnections: 0.
Number of emails quarantined: 0.
Number of emails that could not be fetched: 0.
Number of emails that were returned empty by gmail: 0
Export your Gmail backup for Thunderbird
It’s as simple as writing:
gmvault export /tmp/my-mbox-export -d /home/myuser/gmvault-db/
You can then import this folder directly to Thunderbird.
If you see many errors like:
Received an IMAP abort error. Wait 1 seconds and retrying.
Disconnecting from Gmail Server and sleeping ...
Reconnecting to the from Gmail Server.
Edit this file: ~/.gmvault/gmvault_defaults.conf
And set: enable_imap_compression=False
This should help.