Transition Evolution to a new installation

We recently converted the operating system from openSUSE Leap 42.2 to Linux Mint (8) KDE. Doing so required transfering our Evolution data to the new OS.

We keep the Evolution data on a separate partition (/data/comms/internet/evolution) so that it doesn’t get corrupted by a system change. We then link the appropriate elements of that data to the default locations under /home/user/.

The best method is to use File→Backup/Restore. This writes the data (messages, contacts, etc.—but not the configuration files) to a tar.gz file. It You can restore from that file and then copy (write-into) any other message files you may have that were not in the backup tree.

However, restore will restore to /home/user/, not /data/comms/internet/. So we use an external program (LuckyBackup) to backup
/data/comms/internet/evolution
to an external medium. Restoration is simply a matter of reconstructing the links from

/data/comms/internet/evolution
to
/home/user/

There are two links that must be constructed when restoring:
man ln:
ln [OPTION]... TARGET... DIRECTORY (3rd form)
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.

The configuration files:
 ln -s /data/comms/internet/evolution/ /home/user/.config/

This links the configuration files. .config does not contain the message tree, so ignores them:
The message tree:
   ln -s /data/comms/internet/evolution /home/user/.local/share/

This links the message tree to its proper home in
    /home/user/.local/share/evolution/mail/local/

Ensure that you give the LuckyBackup enough time when backing up separately:
It builds the tree quickly but takes time to transfer the messages. You end up with an empty tree if you don’t give it enough time.

==== Background ====

 Format

https://forums.linuxmint.com/viewtopic.php?t=88648

Evolution format changed from 2.32 to 3.x. In both cases, the data was stored in ~/.local/share/evolution/mail/local/ according to XDG Base Directory Specification (http://www.freedesktop.org/wiki/Specifications/basedir-spec). Inside that data directory, the format and the tree structure changed.

The 3.x format

In Evolution 3.x, the emails were stored in Maildir instead of Mbox format.

In Maildir format, a mail folder is composed of one directory (often called Maildir in Linux) containing 3 subdirectories called cur, new, and tmp. The subdirectory cur contains one file for each email of the folder, i.e., one file per email instead of one file containing all emails as in Mbox format.

File structure

This is the top level file structure of

/data/comms/internet/evolution/

Mail

This is the structure of the mail folder
/data/comms/internet/evolution/mail

The folders folder contains an xml file for each folder

The .local folder contains a directory tree mirroring the files in folders:

Each topic branch has three sub-branches (cur, new, tmp). cur contains the actual messages:

The program seems to be self-healing: when you leave the directory it reconstructs the index and any missing message
headers have been removed.