[NBLUG/talk] Opinions: maildir vs mbox
ME
dugan at passwall.com
Thu Jun 12 18:14:01 PDT 2003
Eric Eisenhart said:
> On Thu, Jun 12, 2003 at 08:18:32AM -0700, Robert Hayes wrote:
>> The newest kmail client defaults to maildir as the default storage
>> format.
>>
>> All of my existing mail has been in mbox format.
>>
>> Any opinions on pros/ cons of each system?
>
> Maildir has some advantages over mbox:
> 1) No locking is required for operations, even over NFS.
> 2) opening up your giant mailbox, deleting one message and closing the
> mailbox is much faster.
>
> Maildir does generally seem to be a bit slower to open than mbox format
> and
> is likely to use more space, as well. Not much more, but a small
> percentage.
>
> Basically:
> Mbox is a single giant file. This is very efficient, as there's only
> about
> one extra byte used per message and only a few bytes used for each
> mailbox.
> To deliver to the mailbox the mailbox is locked and email is appended.
> Changing flags or deleting a message requires locking the mailbox and
> rewriting the entire mailbox.
>
> Maildir is a format that uses a directory with three directories in it.
> Each message is in an individual file with a name like "time.pid.host".
> Time can actually be in any format unique to that host, but "unix time" is
> most common ("date +%s" will show you current unix time). Pid can
> actually
> be anything that's guaranteed to be unique for the duration of that
> timestamp, the life of the delivery process or 24 hours. Host must be
> unique. Delivery is a little complicated, but basically involves writing
> into a properly named file in the "tmp" subdir and then moving it into
> new.
> Changing flags is done by renaming to add ":flag1,flag2". (renaming a
> file
> is an atomic operation.) Deleting a message is done by deleting the file
> it's in. And it all works just fine and dandy over NFS, since NFS
> provides
> an atomic guarantee on creating hard links and deleting files.
>
> Unless a 1% size difference makes a difference to you, I'd recommend using
> Maildir. It eliminates the classic locking problems that mbox format has.
> Mbox is more useful if you're, say, sending over the wire to somebody.
>
> And as a practical matter, Maildir allows nesting mailboxes.
Just one more thing to add. If you are a larger organization, and have
many users using Maildir and storaing many messages on a moounted volume,
you may need to consider altering the format for the partition / volume
you plan to use (namely on inodes and making sure you won't run out.)
Single user in a household will not likely ever have this problem with
Maildir on present drives (based on estimates of space, size and file
numbers.)
-ME
More information about the talk
mailing list