Migrating maildirs - Courier to Dovecot
I apologise, because I'm sure this subject has been done to death, but I want to migrate from Courier to Dovecot.
I think my main question is whether there's any reason I shouldn't just rsync the maildirs across from the old mail server to the new one?
There aren't many clients using this server, so I don't care if clients have to redownload all their messages (in fact, I expect they'll probably end up doing so anyway).
I'd like to preserve read/unread status of each message, but can't think of anything else important.
It doesn't matter if there's a few hours of downtime, but I thought to use rsync because I figured I copy the maildirs a day or two ahead of time, and then a sync immediately before going live will be quicker.
Using imapsync [1] looks pretty good, and I'm happy to use that if it'll be "cleaner" or help Dovecot to create its hierarchy more neatly.
It looks like Courier creates a courierimapuiddb, courierimapkeywords and courierimapacl in each folder - can I not just delete these, and hand Dovecot a bunch of maildir directories and files to reindex for itself?
There are probably only a few hundred thousand messages on the server, a few GB worth, although some of them are many years old.
Some of the messages on the old server have the wrong "received" date on them, having the wrong file creation / modification date on the server's filesystem, having been copied there previously (years ago) without using cp's --archive flag. I've always thought I should one day write a script to fix this, perhaps using mboxgrep.
Thanks in advance for any of your thoughts,
Stroller.
[1] https://wiki2.dovecot.org/Migration#IMAP_.3C-.3E_IMAP_copying
Am 21.09.2017 um 20:34 schrieb Stroller:
I apologise, because I'm sure this subject has been done to death, but I want to migrate from Courier to Dovecot.
I think my main question is whether there's any reason I shouldn't just rsync the maildirs across from the old mail server to the new one?
I think it will work, but if maildir is the best solution for you ,study dovecot wiki, be sure configure dovecot right using maildir
There aren't many clients using this server, so I don't care if clients have to redownload all their messages (in fact, I expect they'll probably end up doing so anyway).
I'd like to preserve read/unread status of each message, but can't think of anything else important.
It doesn't matter if there's a few hours of downtime, but I thought to use rsync because I figured I copy the maildirs a day or two ahead of time, and then a sync immediately before going live will be quicker.
Using imapsync [1] looks pretty good, and I'm happy to use that if it'll be "cleaner" or help Dovecot to create its hierarchy more neatly.
It looks like Courier creates a courierimapuiddb, courierimapkeywords and courierimapacl in each folder - can I not just delete these, and hand Dovecot a bunch of maildir directories and files to reindex for itself?
dovecot will index and acl by itself
There are probably only a few hundred thousand messages on the server, a few GB worth, although some of them are many years old.
Some of the messages on the old server have the wrong "received" date on them, having the wrong file creation / modification date on the server's filesystem, having been copied there previously (years ago) without using cp's --archive flag. I've always thought I should one day write a script to fix this, perhaps using mboxgrep.
Thanks in advance for any of your thoughts,
Stroller.
i did maildir rsync migration from dovecot to dovecot many times, no problem, never tested from Courier, but its easy to test before production ,so simply try out, if something dont work go imapsync way which is easy too
[1] https://wiki2.dovecot.org/Migration#IMAP_.3C-.3E_IMAP_copying
Best Regards MfG Robert Schetterer
-- [*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64 Schleißheimer Straße 26/MG, 80333 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263 Vorstand: Patrick Ben Koetter, Marc Schiffbauer Aufsichtsratsvorsitzender: Florian Kirstein
Hi,
On Thu, Sep 21, 2017 at 07:34:47PM +0100, Stroller wrote:
I apologise, because I'm sure this subject has been done to death, but I want to migrate from Courier to Dovecot.
currently, I'm working on the same project here,
I think my main question is whether there's any reason I shouldn't just rsync the maildirs across from the old mail server to the new one?
probably that's not enough, to make a complete and clean migration, you'll be happy with the courier-dovecot-migrate.pl script:
http://www.dovecot.org/tools/courier-dovecot-migrate.pl
That converts all structure in-place from Courier to Dovecot.
There aren't many clients using this server, so I don't care if clients have to redownload all their messages (in fact, I expect they'll probably end up doing so anyway).
without that the POP3 clients downloaded again all messages, but with that script, most clients was able to switch as transparently. (Except the MS Office Outlook - but that's not a "client" in my opinion... :))
I'd like to preserve read/unread status of each message, but can't think of anything else important.
the read/unread status had been kept in case of IMAP, but the MS Office downloaded again through POP3, when I skipped the script above.
It doesn't matter if there's a few hours of downtime, but I thought to use rsync because I figured I copy the maildirs a day or two ahead of time, and then a sync immediately before going live will be quicker.
Using imapsync [1] looks pretty good, and I'm happy to use that if it'll be "cleaner" or help Dovecot to create its hierarchy more neatly.
I didn't checked it, just doveadm ... imapc: command. The result was fine, but the POP3 redownload was annoying.
It looks like Courier creates a courierimapuiddb, courierimapkeywords and courierimapacl in each folder - can I not just delete these, and hand Dovecot a bunch of maildir directories and files to reindex for itself?
I kept them...
a.
-- I � UTF-8
On 22-09-2017 4:34, Stroller wrote: [...]
I think my main question is whether there's any reason I shouldn't just rsync the maildirs across from the old mail server to the new one?
There aren't many clients using this server, so I don't care if clients have to redownload all their messages (in fact, I expect they'll probably end up doing so anyway).
I'd like to preserve read/unread status of each message, but can't think of anything else important.
[...]
Using rsync should be fine, I've done it myself recently several times. What you need to consider:
- The downtime required during the final incremental transfer.
- If you're using the same uid/gid on the destination server make sure you preserve them when transferring the data across.
- To avoid duplicate messages in the destination you *must* use --delete rsync switch for the incremental transfers.
Important: I'm assuming you're using virtual mailboxes under the same uid/gid.
Suggested mandatory steps, ymmv: figure for the estimated outage window.
- Configure Dovecot in the destination to use Maildir and test everything: logging, SSL, authentication, mail delivery and so on. If you have Courier-IMAP specific configuration, e.g. folders that are being automatically created/subscribed upon the first login, replicate it and test it on the Dovecot server as well.
- Do the initial data transfer using "-avz --numeric-ids" and see if you're happy with the result in the destination.
- Run several incrementals adding "--delete" switch, followed by courier-dovecot-migrate.pl *executed as the mail user* to get a ballpark
- Test few mailboxes post-migration and compare the results with the source server.
- On Day D, stop Courier-IMAP and Dovecot services on both servers to prevent any mailbox changes and run the last incremental, sanity checks, IP reconfiguration if Dovecot is the drop-in replacement, start Dovecot, another round of sanity checks, check the logs and so on. Here you're already at the point of no return :)
Adi Pircalabu
On 22 Sep 2017, at 00:15, Adi Pircalabu adi@ddns.com.au wrote:
Using rsync should be fine, I've done it myself recently several times. What you need to consider:
- The downtime required during the final incremental transfer.
- If you're using the same uid/gid on the destination server make sure you preserve them when transferring the data across.
- To avoid duplicate messages in the destination you *must* use --delete rsync switch for the incremental transfers.
Important: I'm assuming you're using virtual mailboxes under the same uid/gid.
Suggested mandatory steps, ymmv:
- Configure Dovecot in the destination to use Maildir and test everything: logging, SSL, authentication, mail delivery and so on. If you have Courier-IMAP specific configuration, e.g. folders that are being automatically created/subscribed upon the first login, replicate it and test it on the Dovecot server as well.
- Do the initial data transfer using "-avz --numeric-ids" and see if you're happy with the result in the destination.
- Run several incrementals adding "--delete" switch, followed by courier-dovecot-migrate.pl *executed as the mail user* to get a ballpark figure for the estimated outage window.
- Test few mailboxes post-migration and compare the results with the source server.
- On Day D, stop Courier-IMAP and Dovecot services on both servers to prevent any mailbox changes and run the last incremental, sanity checks, IP reconfiguration if Dovecot is the drop-in replacement, start Dovecot, another round of sanity checks, check the logs and so on. Here you're already at the point of no return :)
This is all more or less as I hoped or planned it, although you have mentioned some details that I will now be sure not to overlook.
Many thanks.
Stroller.
participants (4)
-
Adi Pircalabu
-
Ervin Hegedüs
-
Robert Schetterer
-
Stroller