This article explains how Thunderbird stores messages on the local disk drive and why it is necessary to compact messages periodically.
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).
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.
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.
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).
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:
During a compaction process, progress is displayed in the Status Bar:
In the Thunderbird | PreferencesTools | OptionsEdit | Preferences | Advanced | Network & Disk Space menu, you can: