[Dovecot] MBOX to Maildir preserving the UIDL (outlook-tested, no redownloading)

Dmitry Filonov FiL at kpoxa.org
Thu May 8 18:41:51 EEST 2008


Horn Wijaya wrote:
> TESTED AND RUNNING, MIGRATING from MBOX to MAILDIR, PRESERVE UID and OUTLOOK
>
> 1. mb2md-3.20.pl -s /var/mail/hwijaya -d home/hwijaya/Maildir/
>    that's converting 444 emails from mbox to 444 files in the Maildir/cur
> folder
> 2. cd /home/hwijaya/Maildir/cur
> 3. grep IMAPbase *
>    and I get
>       1210219860.000000.mbox:2,S:X-IMAPbase: 1202794557 19944
>    The last 2 strings are the KEY to the ORIGINAL UID 
> 4. So in order to prepare the environment to fool it, some calculations are
> needed:
>    How do we get 19501 as the first counter? as expected in the first POP
> TEST above:
>       19944 - 444 emails + 1 = 19501 
> 5. cd /home/hwijaya/Maildir
> 6. echo '3 V1202794557 N19501' > dovecot-uidlist 
>   
Hello,

 First of all, I was looking into this problem of getting the right 
converter for couple years. You can search list archives for that - 
there are more problems with perfect migration, than you know of.
 Second, your calculations assume two things, that are not always true -
1) original mailbox already has X-IMAPbase header (not every mail server 
puts these headers)
2) first message UID is last message UID-<number of messages>, which is 
not true, if you have deleted some messages in between.
 Third, usually servers use different UIDL format, not time+number.
 Last, if you are migrating from mbox to Maildir on IMAP server, then 
you have more than one folder. Probably you have "/" as folder separator 
on mbox-based system. And will have "." on Maildir. That means, Outlook 
will need to refresh it's folder list anyway. And that involves 
re-downloading all messages.

Yes, in your case you might be able to make a perfect migration tool, 
but this won't be ideal for everybody.


P.S. After couple years of thinking, planning and looking for a ideal 
solution I have modified mb2md-3.20.pl script a little and was able to 
migrate about 200Gb of mail with no problem. Yes, most clients had to 
re-download all their messages (I had to force POP3 clients to empty 
their server mailboxes), but it wasn't that big of a deal, as I was 
afraid of. And now, even with much slower hardware I see about 10 times 
lower LA than with mbox.

    FiL



More information about the dovecot mailing list