If I do operations in Thunderbird with many (thousands of) mails, I hear a crashing voice from my HDDs. It sounds really not beautiful.

It happens only if I do something with a lot of mails (for example, moving some thousands into the trashbox). It is also very slow.

How to deal with this problem?

  • If a better answer arrives to this problem, I will accept that. – peterh Sep 24 '18 at 2:13

A quick strace shows that Thunderbird uses an fsync call to synchronize its local databases after every mail operation. It forces the system to write out all of its write cache.1

Doing this, they make thunderbird more stable, because the probability of the damage of the local databases will significantly decrease due to a possible system crash (or thunderbird crash); however they wear the HDDs of the users and make the capacity of the whole system lesser optimal.

Similar behavior can be seen in many other software, too, not only in the opensource world. For example, ext4 writes out the write cache in every 5 seconds, making their own fs sub-optimal. Or the PostgreSQL database also does the same after every committed transaction. These can be easily turned off in both cases, but I couldn't find the same for Thunderbird.

My research has shown no way to turn this feature off, and recompiling thunderbird just for this little feature had been clearly an overkill. Instead, a simple way to forbid all fsync call for thunderbird is easily available, while the Thunderbird doesn't even know, what is going on.

The same mechanism works quite well also for other processes liking to overload the hdds for zero to little results. The workaround requires a C compiler with the development packages.

The trick is to hook the fsync() calls available for thunderbird with a mock, doing nothing.

  1. Insert this into a small .c file, for example into nosync.c:
int fsync(int arg) {
  return 0;

int fdatasync(int arg) {
  return 0;
  1. We compile it into a small shared library with the command gcc -s -Os -Wall -shared -o nosync.so nosync.c.

  2. After that, thunderbird should be called by the command LD_PRELOAD=/path/to/nosync.so thunderbird

Wow! No more HDD killing.

Of course, it removes the extra protection from the internal Firefox databases. It can be particularly dangerous only if you have important data in your local account. However, Firefox holds today more typically everything in an IMAP account, its local databases are only essentially cache. Thus, this regular fsync is not required.

1 Thunderbird is a multi-threaded process, so a little script to strace all of its threads (strace can follow only only a single pid).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.