1. Home
  2. Linux
  3. Back up geary mail profile linux

How To Back Up Your Geary Mail Profile On Linux

Geary is an excellent email program for Linux. It’s elegant, easy to set up, and has lots of useful features like a quick setup for lots of email providers. Unfortunately, for as feature-packed Geary is, it doesn’t have a way for users to create backups of a Geary Mail Profile.

Not to worry! Even if your Geary application doesn’t let you make a backup, the Linux command-line will!

Back Up Geary Mail Profile

The Geary email application for Linux stores various configuration files in the ~/.config/geary/ folder of each user’s home directory. Also, the Geary app saves mail and other stuff in ~/.local/share/geary/. If you’re looking to create a complete backup of everything in Geary, you’ll need to ensure that both of these folders are safe.

Before creating a backup of your mail, use the ls command and view your data, to make sure everything is there. In a terminal, run:

ls -a ~/.config/geary
ls -a ~/.local/share/geary

If nothing happens when you run these two commands, you may need to re-setup your Geary mail client. Re-sign in, and everything should be good to go.

Use the mkdir command to create a new folder on your Linux desktop. In this folder, we will store all Geary data, to make backing up easier.

mkdir -p ~/Desktop/geary-mail-backup

mkdir -p ~/Desktop/geary-mail-backup/config

mkdir -p ~/Desktop/geary-mail-backup/local

Your Geary backup folder is ready. Now it’s time to move all account configs and email data into it. Start by using the cp command to make a copy of your email configuration files.

cp -r ~/.config/geary/ ~/Desktop/geary-mail-backup/config/

Next, make a copy of the rest of your Geary data with cp, and place it in the ~/Desktop/geary-mail-backup folder.

cp -r ~/.local/share/geary/ ~/Desktop/geary-mail-backup/local/

With all the files in place, it’s time to create a TarGZ archive of the backup folder on your Linux desktop. To create the archive, use the tar command.

tar -czvf geary-mail-backup.tar.gz ~/Desktop/geary-mail-backup/

Compressing a backup of an email client can take a while, especially since most email clients store a lot of data. Let the tar command create the archive, and be patient. When the compression process is finished, return to the terminal and use the mv command to move geary-mail-backup.tar.gz to ~/Documents.

Compressing the geary-mail-backup folder into a TarGZ archive is excellent, and allows for easy uploading to cloud storage services like Dropbox, Google Drive, etc. Though, keep in mind that as it isn’t encrypted, anyone can tamper with your email in the right circumstances.

Encrypting Geary Mail Back Up With GPG

Your Geary email data is compressed down to a single TarGZ archive. The next step in this process is to use the GPG encryption tool so that only you can access your backup data.

To encrypt your Geary mail data with GPG, you must first install it. Launch a terminal window and follow the instructions to get the latest version of GPG working on your Linux OS.

Ubuntu

sudo apt install gpg

Debian

sudo apt-get install gpg

Arch Linux

sudo pacman -S gnupg

Fedora

sudo dnf install gpg

OpenSUSE

sudo zypper install gpg

Generic Linux

GPG is one of the leading encryption tools for the Linux platform. As a result, even the most unknown Linux distributions have it in their package repositories. To install it, search for “GPG” in the package manager.

After installing GPG, return to the terminal and use it to encrypt your Geary TarGZ archive.

gpg -c geary-mail-backup.tar.gz

Running the encryption command will open a password prompt in the terminal. Use the prompt and write in a secure passcode. Can’t think of a good password? Do yourself a favor and check out strongepasswordgenerator.com.

Restore Geary Mail Profile Backup

Restoring your Geary email backup on Linux starts by launching a terminal window and moving it from the home folder to the ~/Documents folder.

cd ~/Documents

Geary has settings that go to multiple directories, so it’s not possible to do a quick and easy restore. Instead, this needs to be done manually. Start the process by decrypting the backup. Then, extract the decrypted Tar archive inside of the “Documents” folder.

gpg geary-mail-backup.tar.gz.gpg
tar xvf geary-mail-backup.tar.gz

Use the CD command and move into the newly extracted backup folder.

Note: change username to your username in the command below or CD will not work.

cd home/username/Desktop/geary-mail-backup/

Move into the config backup folder and make a copy of the settings to ~/.config.

cd config
cp -r geary/ ~/.config/

Do the same with the local backup folder.

cd ..
cd local 
cp -r geary/ ~/.local/share/

With the settings restored, open up Geary again. Your email account, along with all of its messages will be there and ready to go!