[Dovecot] Virtual users - what is better Maildir or mbox?

Wojciech Puchar wojtek at wojtek.tensor.gdynia.pl
Tue Jun 26 16:11:18 EEST 2012


> The only draw back I see with maildir is one file per message. This

it is mostly adventage.

> makes it resilient to corruption that mbox sees (if a message gets
> corrupted, you erase one message and that corruption won't propagate
> even if you leave it in place). In many setups this also leads to MUCH
> faster system. On unix systems this doesn't just waste disk space, it

even with 32kB block/4kB fragment filesystem under FreeBSD which is my 
common setup, it isn't that a problem.
i just checked one of my users folder - 2.3GB in 8500 files. the average 
is 270 kilobytes per mail.

checked few others and it looks similar.


dovecot's own storage system can do something in between - packing 
smallest messages by a few in one file.

> could lead to inode (or whatever your *nix of choice calls it)
> depletion.
you decide how much inode you need while creating filesystem on every unix 
system, except filesystems where it is allocated on demand.

What you will gain is clear separation of mails. You may in any case use 
widely available standard unix tools to move, delete, search, whatever 
with this files, and dovecot would rebuild it's indexes then.

The other major gain are backups. With one file per mail 
differential/incremental backups will work fine.

As everyone do backups this is important, unless you have so cheap 
and quick backup system that you can just do full backup most cases.

Tapes, while certainly fast, are unfortunately not a cheap solution 
anymore. I don't mean drive, but cartridges.

The disadventages are more I/O when multiple files are processed but it is 
not a common case. Dovecot makes great job in indexing.

The other may be (with linux) slow operation on huge directories.
I wasn't using linux for 6 years and that's only what i am told from 
others. Possibly it is already improved in linux.

In FreeBSD there is compile time option UFS_DIRHASH for kernel that make 
even million file directories work quick.





as of latter discussion about what microsoft recommends with linux (being 
of course expert of everything) - i would keep silent.



More information about the dovecot mailing list