Compacting folders

(Redirected from Compact Inbox or Other Folder)

This article explains how Thunderbird stores messages on the local disk drive and why it is necessary to compact messages periodically.

How does Thunderbird store messages?

Thunderbird stores messages using the MBOX file format. With this file format, all the messages in each of Thunderbird's folders are concatenated and stored as plain text in a single file on the local hard drive (located into the Mail and ImapMail directories of your Profiles folder).


Why is compaction required?

As messages are added to a folder, the file containing the folder grows larger on the disk. However, when you delete a message or move it from one folder to another, the file on the disk does not automatically get smaller. This is because the original message is simply marked for deletion and hidden from view. It is not physically removed until you "compact" the folder. This temporarily improves performance in large folders but, in time, the large file is less efficient to work with. Therefore, in order to reclaim disk space and improve Thunderbird's performance, folders must be "compacted" periodically.

If a folder goes over a 4 GB size, you will see a warning that "The folder xxx is full, and can't hold any more messages". You must delete some messages or move some messages to another folder to reduce the folder size. (A target folder size of 1-3 GB may be appropriate, depending on your computer's performance capabilities.)


How does compaction work?

To compact a folder, Thunderbird opens the existing MBOX file on the disk (for example, the Inbox). Based on the rules for the MBOX mail format it reads the file one message at a time.

  • If the message is still current, it is copied to a new temporary MBOX file, called Nstmp.
  • If the message is marked as deleted or moved, Thunderbird skips that message and moves on to the next message.

This process is repeated one message at a time until the end of the file is reached. After that the original message storage file is deleted and the new one replaces it. This is followed by the generation of a new index for this message file (for example, called Inbox.msf).


When does compaction occur?

The compaction process is done automatically in Thunderbird (since version 5) when it saves more than 20 MB of space on the disk.

You can also launch a manual compaction request if needed:

  • To compact a single folder, right-click on the folder and select Compact.
  • To compact all folders, select File | Compact Folders.

During a compaction process, progress is displayed in the Status Bar:

Compacting folder message

How can I configure compaction?

In the Thunderbird | PreferencesTools | OptionsEdit | Preferences | Advanced | Network & Disk Space menu, you can:

  • disable automatic compaction (which is not recommended because your folders won't be regularly cleaned of deleted messages)
  • change the compaction threshold (for instance if you deal with a large volume of messages, you may use a larger threshold)

compaction preferences in tb17


See also

Was this article helpful? Please wait...

These fine people helped write this article: . You can help too - find out how.