What is it?
Thunderbird stores all of your local messages in a file on the local computer. One file for each folder that appear in Thunderbird. When you delete or move a message it is marked as deleted in the file that contains it and ignored by Thunderbird. This is great for performance, if the program stopped to actually write a new file without the message in question every time you moved or delete a message it would be so slow as to be unusable. But like all good things there is a price to pay.
Over time the file wastes a significant amount of space, becomes bloated and unwieldy. The only real solution for this is to create a new file without all of the left over junk. This is called compacting in Thunderbird. Those who have used Outlook will be familiar with a prompt asking to compress. This is exactly the same thing with a different name.
Why Must I do it?
There are some general housekeeping reasons such as to save space. But the main reason is to maintain Thunderbirds speed and to make the file small enough for Thunderbird to actually use. Files over 4Gb in Windows and 2Gb ion Linux and Mac systems are unreadable and present either error messages, or can appear as mail simply downloading and never getting to your inbox. So compacting is an essential part of the process of keeping Thunderbird not only working, but working effectively.
Edit: I have had some people point out that the capacity of the NTFS file system is in exabytes and that this is rubbish. Nothing could be further from the Truth. Thunderbird has this limitation and ignoring it will increase your chance of data loss at some future point in time.
Edit 2: Bug 462665 has finally been fixed for release in Thunderbird 12. This brings to an end the 4Gb limit for local files. It does not remove the need to compact, but it does remove on of the major side effects of not compacting, that of having the file exceed to 4Gb limit.
Making it less frequent
Thunderbird compacts when a file contains deleted messages that total a preset size. The default in Thunderbird 5 is 100Mb, but those who go through the upgrade process don't don't necessarily get the benefit of this change, all they see is the regular request to compact because their threshold is still set to the pre V5 level of 100kb.
On the tools Menu go to Options > advanced > Network and disk space and change the 'compact when it will save over' entry to 100Mb or more. If you get lots of mails with large attachments you may have to double or triple the 100Mb.
If Thunderbird appears bent on compacting every time you delete something. There is the possibility that the compact process is not completing, either through interruption (new mail arriving or your anti virus scanner scanning the file)
On the file menu, select offline and then work offline.
Allow any download or sync to occur.
On the View menu, select folders and then ALL
From the file menu select Compact Folders
Go make coffee, this might take a while. Particularly if you have lots of mail
In the bottom left hand corner of your Thunderbird screen eventually a Done Compacting message will appear.
Now you can change your folder view back to whatever it was originally and go back online.
In some circumstances Thunderbird can hang when the compact prompt appears. This hang apparently affects version 3.x.x - 6.0.1. A fix was implemented in version 7
I lost my mail when Compacting
Please complete my survey of those that hard lost data after compact. and see my post on what this is all about
This does appear to happen, the first obvious point is that Thunderbird can not read the index for the file while compacting is in progress, so the mail in the folder will simply disappear while the compact is in progress. Following the completion of the process the mail will reappear. At other times after the compact there will be no messages show in the folder due to some sort of interruption the the process causing an empty index to be created. The cause of this is not really understood, but right clicking the folder and selecting properties and then repair will force a re-index and the mail will reappear as if by magic.
More Fatal apparent data loss can occur when compacting. If the underlying file is corrupt then the compact will write a file that can at best be described as truncated. This is not compact loosing your mail, it is compact showing you the corruption and demonstrating the extent of that corruption. One leading cause of this sort of corruption is anti virus programs that think they understand Thunderbird's filing system quarantining mails and leaving the file in a corrupt state.
Other symptoms of corruption in the mail store are;
- Previously deleted messages reappearing
- Messages with the date of 1969
- Message bodies containing bits of other messages
- Messages in the message list not matching what is displayed when clicked
- Thunderbird apparently going off to sleep before messages in a folder are displayed