Sometimes old server hardware is too old to do its job. Replacement is needed – But how do you relocate the Mailstorage?
Let’s have a look at the scene and do some explanation work:
The CyrusIMAPd has its own mail storage and authenticates against the saslauthd, which talks to the MySQL Server via PAM. – Setting up the new system shouldn’t be a trouble to worry about, as there are good howtos around.
The first step to migrate the server is copying the MySQL tables to the new server. This shouldn’t need any deeper explanatin.
Next step – doing the mailboxes: As the new server doesn’t have any mailboxes created, we need to dump a list of them from the old server to import it on the new one. This all happens with the ctl_mboxlist tool. Using the reconstruct command, we make them useable again. Now they are ready for receiving mail.
To transfer the old mail, we make use of a small trick that makes the knowledge of all usernames and passwords obsolete. We add proxy_authname and proxy_password to our /etc/imapd.conf. That way we bypass authentification at the mailstorage. As this is done, we are able to sync the mailboxes by using imapsync:
[*] net-mail/imapsync
Available versions: 1.121 (~)1.182
Installed versions: 1.182(19:47:59 01/11/07)
Homepage: https://web.archive.org/web/20190408144712/http://www.linux-france.org:80/prj/
Description: A tool allowing incremental and recursive imap transfer from one mailbox to another.
The rest is just a matter of patience and maybe some bash scripting for looping through a list and passing the mailbox list on to imapsync.
imapsync –delete2 –expunge –syncinternaldates –subscribe –syncacls \
–host2 10.7.1.2 –authmech2 PLAIN –ssl2 –authuser2 $proxy_authname –password2 $proxy_password –user2 $mailbox –prefix2 INBOX\
–host1 10.7.1.1 –authmech1 PLAIN –ssl1 –authuser1 $proxy_authname –password1 proxy_password –user1 $mailbox –prefix1 INBOX