10.6 Mail Migration Bug Workaround

October 11, 2009

There’s a small bug in the Mail migration script (/System/Library/ServerSetup/MigrationExtras/65_mail_migrator.pl) if your mail server also happens to be an OD replica. Namely it tries to set the correct ownership of mailboxes right after the upgrade but the binding has not been set up at that point yet. Come to think of it, this should happen to non-OD-master mail server, but I’m not sure.

The point is, chown will not be able to set the permissions since it won’t have any idea of who those users actually are, so after upgrading and re-binding, one should do something like this (as root):

maildir=$(serveradmin settings mail:imap:partition-default | cut -d = -f 2 | sed 's/[ "]//g')
for u in $maildir/*; do
  chown -R $(basename $u):mail $u
done
/usr/bin/cvt_mail_data -r "$maildir"

The last line renames the user folders to their corresponding GUIDs, which also isn’t possible without a working OD master.

On a lighter note, It’s clear that Apple has indeed put a lot of effort into 10.6 server and into making upgrading and migrating as smooth as possible. Quite frankly I don’t remember the last time I’ve been able to read an OS X server manual and find helpful and working instructions which is exactly what has happened more than once installing 10.6. Even working around this bug was a joy thanks to the clear scripts and logs. My faith in OS X as a great server platform is slowly being restored. :-)