Jul 162008
 

Converting from UNIX mbox/mailbox to Maildir – postfix, procmail, Squirrelmail, uw-imap and cyrus-imap

This guide discusses transforming a system from the traditional mbox/mailbox format to the more advanced Maildir format.

I assume you are using the postfix mailer – if not, you will probably want to change over to postfix first or some of this material may not be relevant.

Make a backup

Before commencing, backup your entire system.

Stop the mailer

You do not want any mail coming in while doing the conversion. You should also stop any programs that automatically generate mail locally.

# /etc/init.d/postfix stop

Get the necessary tools

If you are running Debian, this command will get everything you need:

# apt-get install mb2md

Convert each users mail

For each user on your system:

 # su daniel
 $ cd ~
 $ mb2md -m
 $ mb2md -s mail
 $ exit
 # mv /var/spool/mail/daniel /var/spool/mail/daniel.preMaildir
 # mv ~daniel/mail ~daniel/mail.preMaildir

NOTE: The second mb2md command is only needed if the user has a directory ~/mail where they store mbox/mailbox format mail folders.

Later on, you will want to delete the .preMaildir versions to recover disk space. Before you do so, make sure everything is working fine.

Continue reading »