Gmail

Why a Gmail migration doubles your message count

Someone moves a ten-gigabyte mailbox and finds twenty on the other side. Nothing broke: Gmail presented the same messages twice, and the migration faithfully copied everything it was shown.

Gmail has no folders

Inside Gmail a message exists exactly once and labels are tags on it. A message with three labels is one message shown in three places.

IMAP has no such concept. It has folders, and a message lives in a folder. To expose labels to an external client, Gmail presents every label as a folder and adds a system folder called All Mail that contains everything.

The arithmetic follows. Any migration tool sees the message in the label folder and the same message in All Mail, and copies both, because as far as the protocol is concerned those are two messages in two folders.

What the Gmail folder list looks like over IMAP
* LIST (\HasNoChildren \All) "/" "[Gmail]/All Mail"
* LIST (\HasNoChildren \Trash) "/" "[Gmail]/Trash"
* LIST (\HasNoChildren \Junk) "/" "[Gmail]/Spam"
* LIST (\HasNoChildren) "/" "Clients"

What to do about it

The answer depends on what you want on the other side: the label structure, or simply all the mail as one archive.

Measuring the real size in advance

The figure in Google account settings covers Drive and Photos too, which makes it close to useless for planning a mail migration.

Look at folder sizes over IMAP instead: the sum of every folder except All Mail is the structured option, and the size of All Mail alone is the archive option. The gap between those two numbers is what the decision costs.

  1. Run a folder-size pass without copying anything.
  2. Compare the sum of your own folders with the size of All Mail.
  3. Pick an option and exclude the extra folders before the start, not after.
  4. Compare per-folder message counts once the migration finishes.

Other Gmail surprises

Messages in Sent often carry a user label as well, so they land in both places. Same mechanism.

Important and Starred are IMAP folders too, and they are copies as well. Nearly every migration excludes them along with Spam and Trash.

FAQ

Common questions

Can Gmail labels be migrated as labels?

Only when the receiving side is also Gmail. In plain IMAP a label becomes a folder, so a message with three labels lands in three folders.

Will a second run create duplicates?

No. A repeat pass compares the destination and copies only what is missing.

If I exclude All Mail, do I lose the archive?

You lose messages that carry no label and are not in the Inbox. If you rely on the archive, migrate All Mail and exclude the labels instead.

Why does the size still differ on the new side?

Providers account for metadata and attachments differently. Compare message counts per folder, not gigabytes.

Where to next

Move your mail with MoveMailbox

More posts

Find out how big your mailbox is. It costs nothing.

Connect two servers, look at the size and decide. Or take the client and keep everything on your side.

Code on GitHub · built on imapsync · no sign-up