Moving from mbox to maildir

I've decided that it's time to move from mbox to Maildir. Mailboxes are getting larger every year, and so serverload continues to increase. During scheduled maintenance the end of March, I'm converting all mailboxes to Maildir format.

I've run into a number of issues during some preliminary tests :

  • The conversion can't hand the situation that mail get's delivered during the conversion
  • IMAP / POP mutations on the mailbox while converting screws up the conversion process.

The IMAP / POP3 part can be handled the simple way: Lock the user during the conversion, then re-enableĀ  user after the conversion is done. The incoming part is a more challenging issue : You don't want to shutdown the mailserver during the while conversion. You can't tell sendmail to delay mail during a certain time by default.

To solve this, I've written a milter (see www.milter.org), so that during the RCPT TO phase, it checks the user's homedir for a .maildisable file, and echo's the first line of that file if it exists with a 4xx error. That solves the problem :-)