This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.
Differences between revisions 4 and 42 (spanning 38 versions)
Revision 4 as of 2008-01-14 08:21:30
Size: 3464
Editor: TimoSirainen
Comment:
Revision 42 as of 2019-12-20 14:09:53
Size: 3038
Editor: 38
Comment: "mail_location = maildir:~/Maildir" changed to "mail_location = maildir:~/INBOX"
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
'''WARNING: Badly done migration will cause your IMAP and/or POP3 clients to re-download all mails. Read [[Migration]] page first carefully.'''
== Courier v0.43 and later to Dovecot v1.1+ ==
[[https://dovecot.org/tools/courier-dovecot-migrate.pl|courier-dovecot-migrate.pl]] does a perfect migration from Courier IMAP and POP3, preserving IMAP UIDs and POP3 UIDLs. It reads Courier's {{{courierimapuiddb}}} and {{{courierpop3dsizelist}}} files and produces {{{dovecot-uidlist}}} file from it.
Line 3: Line 6:
If you're using only Courier IMAP, it's possible to do a perfectly transparent Dovecot migration. If you're using Courier POP3 and you have users who keep mail in the server, you may have problems keeping the POP3 UIDLs unchanged.

== Courier v0.43 and later ==

[http://www.dovecot.org/tools/courier-dovecot-migrate.pl courier-dovecot-migrate.pl] attempts to do as perfect migration from Courier as possible. Basically it reads Courier's uidlist files from all maildirs and generates {{{dovecot-uidlist}}} files out of them. If you're using only IMAP, it should work with any Courier version. If you're using Courier POP3 also, it reads {{{courierpop3dsize}}} files using a Courier v0.43+ format. If you have an older Courier POP3 version, see the following sections how to convert the UIDLs.

Before the actual conversion, you can check how well it can be done:
Before doing the actual conversion you can run the script and see if it complains about any errors and such, for example:
Line 12: Line 9:
# courier-dovecot-migrate.pl --recursive
Finding maildirs under .
home/tss/Maildir/courierpop3dsizelist: 2 / 2956 needs changing
home/tss/Maildir/courierimapuiddb: 2956 / 2957 needs changing
# ./courier-dovecot-migrate.pl --to-dovecot --recursive /home
Finding maildirs under /home
/home/user/Maildir/dovecot-uidlist already exists, not overwritten
/home/user/Maildir2: No imap/pop3 uidlist files
Total: 69 mailboxes / 6 users
       0 errors
No actual conversion done, use --convert parameter
}}}
The actual conversion can be done for all users at once by running the script with {{{--convert --recursive}}} parameters. Make sure the conversion worked by checking that {{{dovecot-uidlist}}} files were created to all maildirs (including to subfolders).
Line 17: Line 19:
Total: 2 POP3 changes, 2956 IMAP changes, 0 errors
}}}

This means that 2 POP3 UIDLs need to be changed (clients will download them as duplicates) and only one IMAP UID can be converted without changing it. Changing IMAP UIDs isn't as bad, it will only cause a somewhat heavier load to your mail server when the IMAP clients begin downloading the old mails again.

The actual conversion can be done for all users at once by running the script with {{{--convert --recursive}}} parameters. Make sure the conversion worked by checking that {{{dovecot-uidlist}}} files were created to all maildirs (including to subfolders).
The {{{--recursive}}} option goes through only one level down in directory hierarchies. This means that if you have some kind of a directory hashing scheme (or even domain/username/), it won't convert all of the files.
Line 26: Line 23:
{{{ {{{#!plain
Line 31: Line 28:
courier-dovecot-migrate.pl --quiet --convert ~/Maildir courier-dovecot-migrate.pl --quiet --to-dovecot --convert Maildir
Line 36: Line 33:
FIXME: The script should rename also folder names that aren't valid mUTF-7. Dovecot can't otherwise access such folders.
Line 37: Line 36:
Line 41: Line 39:
protocol pop3 {
  pop3_uidl_format = UID%u-%v
}
mail_location = maildir:~/INBOX
Line 45: Line 41:
mail_location = maildir:~/Maildir

namespace private {
namespace {
Line 49: Line 43:
  separator = .
Line 52: Line 47:
See also [[Namespaces#Backwards Compatibility: Courier IMAP]].
Line 54: Line 50:

* Courier's {{{courierimapsubscribed}}} file is compatible with Dovecot's {{{subscriptions}}} file, but you need to remove the "INBOX." prefixes from the mailboxes.
 * Courier's {{{courierimapsubscribed}}} file is compatible with Dovecot's {{{subscriptions}}} file, but you need to remove the "INBOX." prefixes from the mailboxes.  ''This is true even if you set namespace prefix to "INBOX." as described above.''
Line 59: Line 54:

== Older Courier POP3 versions ==

 Courier version 0:: {{{
# Courier version 0 (using maildir filenames)
pop3_uidl_format = %f}}}
 Courier version 1:: {{{
# Courier version 1 (UID)
pop3_uidl_format = %u}}}
 Courier version 2 and early Courier version 3:: {{{
# Courier version 2 (UIDVALIDITY and UID - you most likely want this)
pop3_uidl_format = %v-%u}}}

Courier IMAP/POP3

WARNING: Badly done migration will cause your IMAP and/or POP3 clients to re-download all mails. Read Migration page first carefully.

Courier v0.43 and later to Dovecot v1.1+

courier-dovecot-migrate.pl does a perfect migration from Courier IMAP and POP3, preserving IMAP UIDs and POP3 UIDLs. It reads Courier's courierimapuiddb and courierpop3dsizelist files and produces dovecot-uidlist file from it.

Before doing the actual conversion you can run the script and see if it complains about any errors and such, for example:

# ./courier-dovecot-migrate.pl --to-dovecot --recursive /home
Finding maildirs under /home
/home/user/Maildir/dovecot-uidlist already exists, not overwritten
/home/user/Maildir2: No imap/pop3 uidlist files
Total: 69 mailboxes / 6 users
       0 errors
No actual conversion done, use --convert parameter

The actual conversion can be done for all users at once by running the script with --convert --recursive parameters. Make sure the conversion worked by checking that dovecot-uidlist files were created to all maildirs (including to subfolders).

The --recursive option goes through only one level down in directory hierarchies. This means that if you have some kind of a directory hashing scheme (or even domain/username/), it won't convert all of the files.

You can also convert each user as they log in for the first time, using PostLoginScripting with a script something like:

#!/bin/sh
# WARNING: Be sure to use mail_drop_priv_before_exec=yes,
# otherwise the files are created as root!

courier-dovecot-migrate.pl --quiet --to-dovecot --convert Maildir
# This is for imap, create a similar script for pop3 too
exec /usr/local/libexec/dovecot/imap

FIXME: The script should rename also folder names that aren't valid mUTF-7. Dovecot can't otherwise access such folders.

Dovecot configuration

Courier by default uses "INBOX." as the IMAP namespace for private mailboxes. If you want a transparent migration, you'll need to configure Dovecot to use a namespace with "INBOX." prefix as well.

mail_location = maildir:~/INBOX

namespace {
  prefix = INBOX.
  separator = .
  inbox = yes
}

See also Namespaces#Backwards Compatibility: Courier IMAP.

Manual conversion

  • Courier's courierimapsubscribed file is compatible with Dovecot's subscriptions file, but you need to remove the "INBOX." prefixes from the mailboxes. This is true even if you set namespace prefix to "INBOX." as described above.

  • Courier's courierimapuiddb file is compatible with Dovecot's dovecot-uidlist file, just rename it.

  • Courier's message flags are compatible with Dovecot (as they are specified by the Maildir specification)
  • Courier's message keywords implementation isn't Dovecot compatible. There doesn't exist a simple way to convert the keywords manually.

None: Migration/Courier (last edited 2019-12-20 14:09:53 by 38)