mailbox / user migration to a new server

Scott Lambert lambert at
Sat Jan 6 17:22:03 EST 2018

On Tue, Jan 02, 2018 at 02:00:59PM +0100, Kristian Rink wrote:
> Folks;
> we're in the process of moving an "old" (cyrus 2.2.13, local Unix users) 
> IMAP structure to a "newer" installation (cyrus 2.4.18, ActiveDirectory 
> users attached using winbind). In total I'm about to move somewhere next 
> to 300GB of mail spool knowing that ...
> - ... all this data has to be moved from one server to another and
> - ... most of the users now do have different user names (as the "old" 
> Unix names differ from the "new" AD names) so data needs to be copied 
> between different mailboxes.
> So just copying /var/spool/cyrus won't possibly work. Likewise, however, 
> I can't use any of the IMAP migration scripts that do these things on a 
> per-user basis as I am not supposed to know or mess with each users 
> passwords; whatever I do sync-wise should be done using cyrus / 
> administrative user accounts.

With cyrus-imapd on both ends you shouldn't have to know the
users' passwords.  The cyrus admin user should be able to login
to the user's mailboxes on both servers.  I believe IMAPsync, , has the ability to specify the admin
login to use when migrating any mailbox.


I've not used that feature as I'm always migrating from not-cyrus to
cyrus and keeping the passwords the same. 

You should just need a CSV file mapping old username to new username
and a looping shell script calling imapsync for each user.  With that
much mail, you may want to split the CSV into several chunks and run the
script in parallel with the different files to get more performance.
The imapsync site has example scripts.

The sync process is not speedy, but it works.  You can keep repeating
the process until it completes quickly enough for you to be happy with
the final cutover to new server time.  I ran the scripts continuously
for a week when I got task switched to something else.  It was ready for
the transition when I was.  

When you throw new mail delivery to the new server, you can keep running
the process without any delete2 options to ensure you don't miss
anything before you switch client IMAP activity to the new server.

Also you don't have to reconstruct each mailbox, unlike when you're done
moving data manually.  That process was painful during the upgrade from
2.3.x to 2.4.  I only had about 100GB of mail at the time.  Of course,
that was years ago and your disks are probably faster.

Scott Lambert                    KC5MLE                       Unix SysAdmin
lambert at

More information about the Info-cyrus mailing list