Wednesday, July 10, 2013

Gmail Account Backup in Ubuntu

We always hear about backing up your data, because data is so important to us, but do we have ever think about backing up our web based email? There is a way we can use it to backup our Gmail account.

In windows, there are many applications like Thunderbird and GMVault, which you can use to backup your Gmail account. But how to do the same thing in Linux based operating system? Linux operating system also supports Thunderbird to back up the Gmail account, but there is a better alternative known as Getmail. Getmail is compatible with all Linux versions.

Now we'll see how to back up the Gmail account. This demo is done on Ubuntu 11.10 version of Linux.

 Ubuntu users can easily download and install getmail from Ubuntu Software Center. Other Linux users can get it from download getmail .


After downloading, you have to create a configuration directory, a directory to store mbox file. To do this, open a terminal window and type the following command:-
       mkdir –m 0700 $HOME/.getmail

To create a directory for the mbox file that will be filled with your Gmail messages, type the following command. We can give other name also for the directory of your choice instead of “gmail-archive”.

       mkdir –m 0700 $HOME/gmail-archive

Now, you must create mbox file to contain the download messages. Getmail does not do this by its own. WE have to create it by typing the following command:-

      touch ~/gmail-archive/gmail-backup.mbox

Next, we have to create the configuration file to tell Getmail about your Gmail account. Open a text editor, such as gedit and copy the following commands into the file.

     type = SimplePOP3SSLRetriever
     server =
     username = 
     password = yourpassword
     type = Mboxrd
     path = ~/gmail-archive/gmail-backup.mbox
     verbose = 2
     message_log = ~/.getmail/gmail.log


Put the username and password of your Gmail account. And if you used a different directory and filename for the mbox file then change the path accordingly.

Then save the file as “.getmail/getmailrc”.


Then run Getmail, by typing getmail in the terminal. Then you'll get all your Gmail messages.


When Getmail finishes all downloading of the messages, you can see the contents in the mbox file.