Backup and restore Gmail with GMvault

Introduction

GMvault is very easy to use, lightweight and quick application that is used to backup and restore all of your email accounts from gmail. Although a number of gmail back solutions are available but gmvault is very popular and open source tool.It is available for MAC, Linux and Windows, gmvault is very stable can handle IMAP related issued with gmail.With full sync mode user can have back up of entire mail account in a dedicated unique directory without any messup, these emails can be compressed can easy to move to some another location.It can sync your  mail accounts daily to keep your data up to date. In addition even a non technical user can also easily mange their mail accounts, no data base is required to manage and organize mail backups.Another important feature of the tool is that gmvault can recreate your gmail box and any other gmail account, even all of the attributes and labels will also be preserved.

Reference link: http://gmvault.org/index.html

Installation

First we need to create a  gmail account for this demonstration purpose, we have created a demonstration email account with email id “examplelinux.com”

Selection_016Download gmvault package form this link

Extract package

$ tar -xvf gmvault-v1.9-src.tar.gz

Install required python tools

$ sudo  apt-get install python python-setuptool

After python and python tools package got installed change directory to gmvault

$ cd gmvault-1.9/

Install package using following command

$ sudo python setup.py install

Run following command to have available command line option

$ gmvault -h
Sample output
Odd. Use default python2.7.x or 2.6.x distribution.
usage: gmvault [-h] [-v] {sync,restore,check,export} ...
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
subcommands:
{sync,restore,check,export}
valid subcommands.
sync synchronize with a given gmail account.
restore restore gmvault-db to a given email account.
check check and clean the gmvault-db disk database.
export Export the gmvault-db database to another format.

Examples:

a) Get help for each of the individual commands

#> gmvault sync -h
#> gmvault restore --help
#> gmvault check -h
#> gmvault export -h

Synchronize your gmail account, give following command

 $ gmvault sync examplelinux@gmail.com

You have to press enter to launch browser, Sample output

Odd. Use default python2.7.x or 2.6.x distribution.
Use gmvault-db located in /home/virtual/gmvault-db.
Activate Gmvault db cleaning.
Authentication performed with Gmail OAuth2 access token.
Initiate interactive session to get OAuth2 token from Gmail.
gmvault will now open a web browser page in order for you to grant gmvault access to your Gmail.
Please make sure you're logged into the correct Gmail account (examplelinux@gmail.com) before granting access.
Press ENTER to open the browser.
You should now see the web page on your browser now

When you will press enter browser will popup, click allow to enable gmvault backup feature

Selection_017

A next window will appear, it will display a code and paste that code to terminal

Selection_018

Paste that code to command line already active for vmvault, press enter and synchronization will start quickly

Selection_020

All these mail will be stored in gmvault-db directory under user’s home. Have a look

$ cd /home/virtual/gmvault-db/ && ls

Selection_021

Similarly you can upload email back to gmail accounts as well.

Complete restore you gmail account to some another email account

 $ gmvault restore -d ~/gmvault-db anotheremail@gmail.com

Restore back to same account

$ gmvault restore -d ~/gmvault-db examplelinux@gmail.com

Selection_022

Let us delete all of the emails from inbox, to make sure that the tool is working or not!

Selection_023

Run gmvault again

$ gmvault restore -d ~/gmvault-db examplelinux@gmail.com

Email are visible in your inbox again.

Selection_024

The  quick restore option will only the sync last 2 months  mail of your gmail account

$ gmvault restore --type quick -d ~/gmvault-db examplelinux@gmail.com

If user want to restore all of the emails with a defined label, run the following command

 $ gmvault restore --apply-label "test" -d ~/gmvault-db examplelinux@gmail.com

Now restored emails will appear with a label named “test”

Selection_025

This is all for now, Have fun!!