Problem

My Thunderbird Profile is growing and growing. I just deleted everything i could, but it still doesn't free up the space. What is wrong?

Solution

When you delete messages in an email program ("email client") or move them to another folder in the program, they are not yet physically removed - even emptying the Trash does not remove them. Instead, Thunderbird and other email programs simply hide the "deleted" messages and mark them as ready for physical removal. The process of physically removing such no longer visible messages is called "compacting".

What is compacting?

Email programs do not immediately physically remove messages deleted by users and instead only hide them from view because this improves performance when the users delete messages in large folders. This is because email messages are not separate files; instead, they are consecutive parts of one large file (one file per folder in Thunderbird, one file per entire message store in some other programs). If email programs immediately physically removed messages deleted by the user, they would have to rewrite the entire contents of a folder every time the user deletes a single message.

When a user deletes 10 messages one at a time in a 100MB folder, Thunderbird can quickly hide them by simply modifying a status header in each message, and Thunderbird doesn't need to rewrite the entire folder until later, when the user compacts it (or lets Thunderbird do it automatically). If the user had to wait while Thunderbird rewrote the entire contents of the folder every single time the user deleted a message, the user would have to wait for a total of 10 times as long as it takes to rewrite 100MB. Compacting is a good performance tradeoff for large folders, but for simplicity you can't choose which folders have to get compacted.

If a folder has a lot of messages, and if messages are frequently deleted in it, and if you don't compact it frequently, this greatly increases the chance of the folder becoming corrupted. This creates message fragments, and may cause erratic behavior as Thunderbird tries to parse (analyse) the file containing the messages for that folder. Usually this is only a problem for the inbox folder. That is why the keep it working article recommends that you keep the inbox folder as empty as possible (by moving to another folder any messages you want to keep) and configure Thunderbird to automatically compact folders.

What happens if you do not compact folders?

If you rarely or never compact folders, your mail files will accumulate more and more of the "hidden" messages that have been marked for permanent deletion but have not yet been removed. This can cause a lot of disk space to be used, and it can have a negative effect on Thunderbird’s performance.

How to compact folders

Automatically

The easiest way to compact is to let Thunderbird do it automatically: Tools -> Options -> Advanced -> Network & Disk Space -> Disk Space -> Compact folder when it will save over 100 MB -> OK.

However, it is best to not to do anything in Thunderbird except read messages if you notice that compacting has started. If you tag, mark, or move messages during compacting, this can cause folder corruption and data loss. In addition, if you are in the process of writing an email while compacting starts, you may get an error when you try to save or send it. (This can be especially annoying if you're responding to an email with interleaved replies because copy-pasting to a new message will often move quotation marks into the middle of lines in quoted sections).

If you often delete many messages in very large folders and feel that Thunderbird becomes unresponsive while trying to delete more messages, you may want to try using a larger figure. This will reduce the chance that compacting starts and locks up the folder while you are trying to delete more messages. If you use a figure much larger than 1000 kB, compacting will take much longer and there is a greater risk of folder corruption.

Manually

If you are annoyed by Thunderbird suddenly becoming unresponsive while using it, you may want to turn off automatic compacting and instead compact manually when you don't need to use Thunderbird. If you want to combine the advantages of both methods by making Thunderbird ask for permission before it starts compacting automatically, see customizing compacting below.

To compact all folders in an account manually, click the account on the left, and then click File -> Compact Folders. This has to be repeated for each account. Compacting an account may take from a few seconds to 10 minutes or more, depending on how much mail you have and how recently you last compacted the folders. If you have trouble doing this and the process stalls, try compacting one folder at a time by right-clicking on the folder and choosing "Compact" ("Compact This Folder" in older versions). If you do not let Thunderbird compact automatically, you should do this regularly, at least once a week. If you do it daily, it will take only a fraction of the time.


CategoryTBD

FAQ/ThunderbirdCompactingFolders (last edited 2020-09-14 20:38:40 by gfreudig)