Support Howtos Migrating Mail To ClearOS

Migrating Mail To ClearOS

Overview

This howto provides information on how to migrate mailboxes to ClearOS.

Migrating from a Remote IMAP Server

Here are the required steps for migrating mail to ClearOS.

  • Create the necessary user accounts on the ClearOS system. During this process, create a corresponding username/password text file on the ClearOS system. This file is only used for migrating mail and can be deleted once migration is complete. The username/password file has the following format:
username1|password1
username2|password2
username3|password3
  • Make sure the IMAP mail server is up and running!
  • Run the imap2cyrus command with the following flags:
    • –host: the hostname or IP of the old mail server
    • –port: the port for the mail server (defaults to 143)
    • –file: the name of the username/password file created earlier

Example

If your old server is on the ip address of 192.168.1.4 and your file with the users and passwords was in the current directory that you are and and was named users.txt your command that you issue on the new ClearOS server would look like this:

imap2cyrus --host 192.168.1.4 --port 143 --file ./users.txt

If you would like the results of the import to be logged as well, the command would look like this (Recommended):

imap2cyrus --host 192.168.1.4 --port 143 --file ./users.txt 2>&1 | tee mailimport.log

Alternate Methods

If the above process does not work, it may be because of corruption with the original IMAP data store or some other reason. Check the output of the log file to validate that mail was imported.

Client-based mail migration

A separate way of migrating mail is to set the IMAP client to use both the old and the new server. The users can then migrate whichever mail items they want by dragging and dropping the mail or mail folders into the new system. This method is useful if you suspect corruption in the original users' IMAP database on the old server.

Offline migration from backup or offline server

Sometimes, the old server is no longer available and you cannot use either of the previous methods. This can occur if you did a re-install or if the old server is not functioning or if you are recovering from backup.

First, set up all the user accounts with the same usernames as existed on the original system. Make sure mail is NOT being delivered to the new server because we will be overwriting the default mail folders on the new system with the mailboxes from the old system. Make sure the cyrus-imapd is NOT running. Restore the entire contents of /var/spool/imap/ to the new server. Validate that the cyrus user owns the mail directories:

chown -R cyrus:mail /var/spool/imap

Cyrus cleans up the database on a stop command but not on a restart. Even though Cyrus is stopped, rerun the stop command:

service cyrus-imapd stop

Start the IMAP service.

service cyrus-imapd start

 
TryBuy