I finally migrated my mails from mbox format to mdbox format using dsync:
- Stop dovecot, wait a few seconds for processes to die
- dsync convert mdbox:~/mdbox
- Change mail_location to mdbox:~/mdbox
- Check that no new mails arrived during conversion (alternatively I could have just run dsync again, but I decided not to test my luck)
- Start dovecot
After fixing a pretty bad bug in dsync and a couple of other unrelated bugs, everything seemed to work correctly and transparently. UIDs and everything was preserved as expected. I think I even feel my mail clients being faster than with mbox :)
~% du --exclude=.imap -bsh mail-old-mbox 707M mail-old-mbox
~% du -bsh mdbox/* 27M mdbox/mailboxes 704M mdbox/storage
The reason why I'm giving -b is because without it, mdbox was a lot larger than mbox (734 MB vs. 710 MB). I guess this is because zfs internally decided to waste some space for the files.
~/mdbox/storage% ls -lS -rw------- 1 tss tss 13602413 2010-01-29 18:05 m.68 -rw------- 1 tss tss 10487382 2010-01-29 18:06 m.209 -rw------- 1 tss tss 7749964 2010-01-29 18:06 m.270 -rw------- 1 tss tss 7493010 2010-01-29 18:05 m.69 .. -rw------- 1 tss tss 2097246 2010-01-29 18:06 m.175 -rw------- 1 tss tss 2097213 2010-01-29 18:06 m.151 -rw------- 1 tss tss 2097173 2010-01-29 18:06 m.197 -rw------- 1 tss tss 2097163 2010-01-29 18:05 m.89 -rw------- 1 tss tss 1307164 2010-01-29 18:33 m.296
Total of 296 files. The reason why there are a few large files is because their last mail is huge. I guess in future mdbox should try to avoid doing that if it knows the mail's size beforehand. Actually I thought it already tried to do that..
Anyway, let's hope it doesn't now corrupt all my mails.