Revert "Translate all posts to German with personal blog style"
Build & Deploy / deploy (push) Successful in 27s

This reverts commit cc7ba433d4.
This commit is contained in:
2026-06-06 19:27:10 +02:00
parent cc7ba433d4
commit 057a61a14c
5 changed files with 184 additions and 149 deletions
+34 -37
View File
@@ -1,76 +1,73 @@
+++
date = '2025-05-18T11:34:09+02:00'
draft = false
title = 'Wenn der Dovecot-Index durchknallt'
title = 'Dovecot Index Cache Issues'
[cover]
image = "/imgs/dove.jpg"
alt = "Tauben auf nem Dach"
caption = "Die Tauben auf dem Bild haben übrigens nix mit Dovecot zu tun. Fand ich nur passend."
alt = "Bunch of Doves on a roof"
caption = ""
+++
# Wenn `dovecot.index.cache` dich in den Wahnsinn treibt
Letztens hab ich ein altes Mail-System in sein neues Zuhause umgezogen. Nach der Migration check ich die Logs und seh Warnungen wie diese:
# Understanding `dovecot.index.cache`
I recently migrated an old mail server system into its new home. After the migration, I checked the logs and noticed some warnings that looked like this:
```
May 17 11:23:13 server1 dovecot: dsync-local(user@domain.tld)<cRjZCwGnKWiIvicA2dm5Tw>: Error: Mailbox INBOX: mmap(size=511310568) failed with file /var/vmail/domain.tld/user/Maildir/dovecot.index.cache: Cannot allocate memory
```
The error indicates that the `dovecot.index.cache` file is too big to process, and Dovecot cannot allocate enough memory to handle it.
Übersetzung: Die `dovecot.index.cache`-Datei ist so fett, dass Dovecot nicht genug Speicher hat, um sie zu verarbeiten. Ja, **500 MB** für 'ne Index-Datei. Das ist kein Index mehr, das ist ein Roman.
# What Are `dovecot.index.cache` Files?
## Was Sind `dovecot.index.cache`-Dateien Überhaupt?
Dovecot, the most popular IMAP server, uses a set of index files (`dovecot.index`, `dovecot.index.cache`, `dovecot.index.log`, etc.) to speed up mailbox access. The file I had to deal with stores cached message metadata (headers, flags, and preview text) so Dovecot does not have to read each message file in the mailbox every time.
Dovecot, der beliebteste IMAP-Server auf diesem Planeten, benutzt Index-Dateien (`dovecot.index`, `dovecot.index.cache`, `dovecot.index.log`, etc.), um den Zugriff auf Postfächer zu beschleunigen. Die Datei, die mir Kopfschmerzen bereitet hat, speichert gecachte Nachrichten-Metadaten (Header, Flags, Vorschautext). So muss Dovecot nicht jedes Mal alle Mails durchforsten, wenn du dein Postfach öffnest.
Over time, the `dovecot.index.cache` file can grow very large or become outdated. Here are a few reasons why this happens:
Mit der Zeit kann die `dovecot.index.cache` allerdings fett werden oder aus der Spur laufen. Hier ein paar Gründe:
### During Normal Operation
### Im Normalbetrieb
- Deleted or moved messages may leave behind unused metadata.
- Corrupt or unreferenced entries might accumulate if a process is interrupted.
- Stale data can hang around for years if not explicitly purged.
- Gelöschte oder verschobene Mails hinterlassen verwaiste Metadaten.
- Korrupte Einträge sammeln sich an, wenn mal ein Prozess abstürzt.
- Datenmüll kann jahrelang rumgammeln, wenn niemand aufräumt.
### After a Migration
### Nach ner Migration
Migrations are particularly prone to creating out-of-sync or bloated index files because:
Migrationen sind besonders fies, weil:
- **File timestamps and UIDs change**: Dovecot's cache is based on assumptions about message state. A migration (e.g. via `rsync` or `imapsync`) may change those assumptions, causing the cache to mismatch the actual message data.
- **Index format/version mismatch**: If you switch Dovecot versions between servers, the format of `.index.cache` might be incompatible or inefficient.
- **Partial cache rebuilds**: After a migration, Dovecot may try to reuse old cache files that no longer reflect the real contents of the mailbox, leading to odd behavior or performance issues.
- **Datei-Timestamps und UIDs ändern sich**: Dovecots Cache basiert auf Annahmen über den Zustand der Nachrichten. Eine Migration (z.B. via `rsync` oder `imapsync`) kann diese Annahmen über den Haufen werfen.
- **Index-Format/Version-Konflikte**: Wenn du zwischen den Servern verschiedene Dovecot-Versionen hast, kann das Format von `.index.cache` inkompatibel sein.
- **Partielle Cache-Neubauten**: Dovecot versucht, alte Cache-Dateien weiterzuverwenden, die nicht mehr zum aktuellen Inhalt des Postfachs passen. Chaos pur.
# How to Deal with These Files
## Wie Werd Ich Die Dinger Los?
After migrating to the new servers, I encountered a few of these messages in the log, so I had to search through and find all users affected by this. Since these large files not only consume unnecessary disk space but also affect performance and cause `dsync` issues, I had to do something about it.
Nach der Migration hatte ich einige dieser Meldungen im Log. Also musste ich alle betroffenen User finden und handeln. Diese riesigen Dateien fressen nicht nur Plattenplatz, sondern killen auch die Performance und verursachen `dsync`-Probleme.
## Is It Safe to Delete These Files?
### Kann Ich Die Einfach Löschen?
Short answer: **Yes** — it's safe to delete all `dovecot.index*` files inside a user's Maildir.
Kurze Antwort: **Ja** du kannst alle `dovecot.index*`-Dateien im Maildir eines Benutzers löschen.
Dovecot will automatically regenerate the indexes when needed. This will result in a small delay the first time a user accesses their mailbox after deleting these files, but performance will return to normal quickly.
Dovecot baut die Indizes bei Bedarf automatisch neu auf. Klar, beim ersten Login nach dem Löschen gibt's kurz nen kleinen Lag, aber danach läuft alles wieder geschmeidig.
### Wie Finde Ich Die Schwergewichte?
Erstmal checken, was bei dir als "groß" gilt. Ich hab mich auf Dateien über 100 MB konzentriert:
## How to Find and Clean Up Large Index Files
First, you should check what "large" means for your setup. I checked for files that are larger than 100 MB in size using the following command:
```bash
find /var/vmail -type f -name "dovecot.index.cache" -size +100M -exec ls -lh {} \;
```
Nachdem ich die Kandidaten identifiziert hatte, bin ich ins Maildir des Users und hab die Dinger plattgemacht:
```bash
After validating these files and users, I then moved into the users Maildir and removed the files:
```
cd /var/vmail/domain.tld/affecteduser/Maildir/
rm dovecot.index*
```
## What Else Can I Do?
### Gibt's Auch Ne Sanftere Methode?
Theres another way to deal with large index files: you could increase the virtual memory limit that Dovecot is allowed to use, which is controlled by the `default_vsz_limit` in Dovecots configuration files.
Klar. Du könntest auch das virtuelle Speicherlimit für Dovecot erhöhen (`default_vsz_limit`). Oder die Einstellungen `mail_cache_fields` und `mail_never_cache_fields` anpassen, damit der Cache gar nicht erst so fett wird.
Another option to prevent future bloat of these files would be adjusting the `mail_cache_fields` and `mail_never_cache_fields` in the configuration.
Ich hab mich fürs Löschen entschieden, weil die Dateien schon vor der Migration so monströs waren. Nach der Neugenerierung sind die Dinger deutlich kleiner. Mal sehen, ob das Thema wiederkommt.
I decided to delete these files for affected users because these files had grown so large before migrating to the new setup. After regenerating, the files are much smaller, and time will tell if this becomes an issue again.
## Fazit
# Conclusion
If you encounter these warnings in your logs, it's worth checking the `dovecot.index.cache` files and dealing with them. Cleaning them up is safe and easy — Dovecot will take care of rebuilding what it needs.
Wenn du diese Warnungen in deinen Logs siehst: Check die `dovecot.index.cache`-Dateien und werd sie los. Aufräumen ist sicher und einfach Dovecot kümmert sich um den Rest. Und denk dran: Ein gut gepflegter Cache ist ein glücklicher Cache.