Maildir vs. mbox: practical storage differences

Compare per-message and per-folder mail storage, including locking, deletion, backups, corruption scope, and inode usage.

Best practices
Maildir vs. mbox: practical storage differences

Maildir stores each message in its own file. An mbox mailbox stores many messages in one file. That difference affects concurrent access, deletion, backups, and the scope of file damage, but it does not establish a universal performance winner.

Storage layout

A Maildir-style layout, with a Maildir++ subfolder, looks like this:

Maildir/
├── cur/     # Current messages; flags determine read status
├── new/     # Newly delivered messages, not every unread message
├── tmp/     # Temporary delivery files
└── .Sent/   # Maildir++ subfolder convention
    ├── cur/
    ├── new/
    └── tmp/

A message can remain unread after moving to cur. Folder naming conventions are an extension or server implementation detail, not the fundamental one-message-per-file rule.

An mbox layout might be:

/var/mail/alice     # Messages in the inbox share one file
~/mail/Sent         # Sent messages share another file

Messages are separated by envelope lines beginning with From. Different mbox variants handle escaping and metadata differently.

Operational comparison

Concern Maildir mbox
Add/delete messages Usually changes the affected message files and indexes Appending is straightforward; expunging can rewrite substantial data
File damage Damage to one message file has a limited scope, although directory/filesystem damage can affect many Damage can affect a whole mailbox file
Concurrent access Delivery avoids one large mailbox-file lock; implementations can still lock indexes, directories, or UID state Correct file-locking coordination is important
Backups File-level incremental synchronization is convenient Whole-file copying is simple; delta-transfer tools can still avoid transferring every unchanged byte
Disk overhead Many files consume inodes and filesystem metadata Fewer, larger files can use space more compactly
Compatibility Supported by servers such as Dovecot, Postfix, and Courier, with implementation-specific details A long-established format supported by many mail tools

Choose for the workload

Maildir is worth evaluating for frequent deliveries, deletions, and access from multiple devices. Test it with the server's index implementation, filesystem, storage latency, and backup process.

mbox can be convenient for local mail archives and exports: one folder maps to one file. Clients such as Thunderbird support mbox, but export/import behavior and indexes remain client-specific.

For very large numbers of small messages, pay attention to random I/O and inode consumption. Dovecot's dbox formats are another option when their operational trade-offs fit the server.

Monitor inode usage

On filesystems with a finite inode supply, Maildir can exhaust inodes while free bytes remain:

df -i /var/mail

Check the filesystem that actually holds the mail. In an existing Guance deployment, a disk collector can track space and inode usage for that mount; correlate those measurements with delivery failures. Mail queue length and delivery state still need mail-server-specific logs or metrics.

FAQ

Can I migrate from mbox to Maildir?

Yes. Dovecot's dsync and other migration tools can do this. Use a supported live-sync procedure with a final synchronization, or stop writes for the cutover. A quiet period alone does not guarantee consistency. Verify message counts, contents, flags, and relevant UID behavior before switching clients.

Why can deleting an mbox message be slow?

The client may initially mark the message as deleted. A later expunge can rewrite the following data to close the gap. Maildir normally removes the individual message file, although indexes also need maintenance.

Can both formats coexist?

It depends on the server's configuration. Dovecot can use different storage for different users. mail_location is familiar from Dovecot 2.3; follow the relevant migration documentation for newer major versions.

References: Dovecot Maildir documentation, mailbox format overview.

Related reading

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting