2

I use rsync to migrate the mails beetween my cyrus 2.3.14 server (source) and 2.3.16 cyrus server (target). However I have a little problem.

On the source cyrus server, the mails were stored in /var/spool/cyrus/domain/d/domain_name and the quota and seen/sub files are stored in /var/lib/cyrus/domain/d/domain_name. On the destination cyrus server, the mails were stored in /var/spool/imap/domain_name and the quota and seen/sub files are stored in /var/lib/imap. On the target's /etc/imapd.conf file, I have the defaultdomain set with the value domain_name and the defaultpartition with the value : /var/spool/imap/domain_name.

So I use the following commands :

  • *rsync -avt --delete --exclude "cyrus.**" /var/spool/cyrus/domain/d/domain_name cyrus_2.3.16_server:/var/spool/imap/domain/d/domain_name* to migrate the mails

and

  • rsync -avt --delete --exclude ".sub" /var/lib/cyrus/domain/d/domain_name/user/ cyrus_2.3.16_server:/var/lib/imap/user* to migrate the seen files.

Then I extract the mailboxes.db from the source server, remove the domain information (cause on the target server I set the defaultdomain and define the defaultpartition) and import it on the target server (ctl_mboxlist -u). To finish, I execute the reconstruct command.

When I check a migrated mailbox (stored in the target server), I got only unread mails. Is there another command or step I have to do or tell me if my method is wrong?

Thank you in advance

Cédric
  • 45
  • 3

1 Answers1

1

You need to migrate the user files to the domain path as well:

First - you can't delete the cyrus.header files, or you'll lose the unique ids and you'll lose the seen information. You may as well keep cyrus.index as well so you don't lose \Answered, \Draft and \Flagged information (plus any user flags) - and then cyrus.cache won't hurt, though you'll probably reconstruct anyway just to be sure.

rsync -avt --delete /var/spool/cyrus/domain/d/domain_name cyrus_2.3.16_server:/var/spool/imap/domain/d/domain_name

Again - why are you ditching the subscription files?

rsync -avt --delete /var/lib/cyrus/domain/d/domain_name/user/ cyrus_2.3.16_server:/var/lib/imap/domain/d/domain_name/user

Finally - I would set defaultdomain to be something else, otherwise your users in that domain won't have split domain paths.

In general, you want the configuration to be as similar as possible between the source and destination machines.

Bron Gondwana
  • 1,738
  • 3
  • 12
  • 15
  • Thanks a lot Bron, I didn't know that the real information was in the cyrus.* files. My migration works very well. – Cédric Dec 09 '13 at 14:27
  • Glad to be of help :) The cyrus.cache file is all re-creatable, but yes - the other two both contain detail which gets lost otherwise! – Bron Gondwana Dec 11 '13 at 03:24