Restoring mailboxes to Cyrus and CRLF
2007 November 17
I had to restore some Maildir-style mailboxes from an old Courier IMAP
server to a newish Cyrus IMAP server. There’s not much to it, and
this is well documented elsewhere, but basically you can copy the
files in (I don’t know if they need to be named like 123. like Cyrus
does by default), make sure permissions are right (and SELinux, if
applicable), and invoke some combinations of reconstruct.
I did hit a few gotchas though:
- Like I said above, don’t forget to
restorecon -Rvon the restored files if you’re on a system with SELinux enabled. - If you have mailboxes, particularly folders underneath the inbox,
you may need to invoke
reconstructwith-p default. This registers them inmailboxes.db, I guess? It makes them show up inlmfromcyradmwhich can’t be bad. - Related to the above, I don’t think
reconstructwill believe a directory is a mailbox unless there is acyrus.headerfile in it. Justtouch cyrus.headerwas enough for me. (I was callingreconstruct -p default -xrfBTW; I don’t know if, for example,-xmakes it rewritecyrus.headerto have valid/meaningful contents. It should be non-empty, I believe.) - Finally, Courier’s messages all just used a line feed for line
endings. Cyrus demands DOS-style CRLF for line endings. Symptom
for this: bringing up the message index (in Mutt, at least) goes
much, much slower than it should. I believe this happens because
too much information gets put in the Cyrus header/cache files. (Use
the
mbexamineprogram and you’ll see lots of weird information in the “headers” I think.) Fixing this for me was as simple as runningunix2dosover the files (and then fixing permissions; I should have donesudo -u cyrus unix2dos [0-9]*.instead of just runningunix2dosasroot.)