Dovecot LDA Mailbox Format Selection: A Practical Guide for Mail Delivery Design
Choose the right mailbox format for Dovecot LDA to balance performance, reliability, and client compatibility.
22 Jul 2025, 19:14 UTC

The Decision: Choosing a Mailbox Format for Dovecot LDA
When configuring Dovecot’s Local Delivery Agent (LDA) you must decide which mailbox format to use. The choice affects locking behavior, filesystem inode consumption, storage efficiency, and client compatibility. The options are mbox, Maildir, and sdbox.
Supported Formats and Characteristics
| Format | Locking Required | Inode Usage | Compression | Client Compatibility |
|---|---|---|---|---|
| mbox | Yes (flock/fcntl) | Low | No | Universal |
| Maildir | No | High | No | Modern clients |
| sdbox | No | Moderate | Yes (built‑in) | Dovecot 2.0+ only |
Trade‑Off Analysis
mbox: Simple and universally supported, but file‑level locking can become a bottleneck when many deliveries write concurrently. Crashes during write may corrupt the file unless recovery mechanisms are in place.
Maildir: Eliminates locking by using separate files for each message, which scales well for high write loads. The downside is high inode consumption; directories with more than a few thousand files can hit filesystem limits.
sdbox: Dovecot’s native format that stores multiple messages in a single file with optional compression and deduplication, reducing storage and I/O. It requires Dovecot 2.0+ and is not readable by traditional mbox or Maildir clients without conversion.
Implementation: Configuring Dovecot LDA Delivery
Set the mailbox format in /etc/dovecot/conf.d/10-mail.conf using the mail_location directive:
# mbox format (default in some installations)
mail_location = mbox:~/mail:INBOX=/var/mail/%u
# Maildir format
mail_location = maildir:~/Maildir
# sdbox format
mail_location = sdbox:~/sdbox
After editing, restart Dovecot and verify delivery:
sudo systemctl restart dovecot
echo "Test message" | doveadm deliver -u [contact removed]
doveadm mailbox list -u [contact removed]
Validation and Limitations
Check the current format with:
doveadm mailbox list -u username
Review /var/log/dovecot.log for delivery errors that may indicate format‑related problems.
Limitations: Migrating between formats requires copying all messages and may need temporary downtime. sdbox needs Dovecot 2.0+ and is incompatible with non‑Dovecot clients. Maildir can degrade when a single directory contains many thousands of files.
Decision Framework
Select mbox for maximum client compatibility and low concurrent write volume. Choose Maildir when write concurrency is high and inode limits are not a concern. Choose sdbox for efficient storage with compression in a Dovecot‑only environment.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.