8 Replies Latest reply: Oct 26, 2013 2:44 AM by TigerKR
Stephen Thomas2 Level 1 Level 1 (10 points)

I'm in the process of changing server hardware from an XserverG5 (10.3.9) to a new Mini Server (10.8.2). I'm serving mail for a couple of domains (imap/pop) and would like to be able to switch over to the new server without having the users loose any mail or have to change any settings in their mail clients.

 

I've been looking for a migration information for mail but the only one I can find is for 10.5+ to 10.7. There are a number of migration scripts listed but they are not part of my 10.8.2 setup.


10.8.2 Server, OS X Mountain Lion (10.8.2)
  • 1. Re: Moving mail services from 10.3.9 to 10.8.2
    pterobyte Level 6 Level 6 (10,910 points)

    First things first: It is possible to migrate data from 10.3 to 10.8. All server versions from 10.3 through to 10.5 used Cyrus as their IMAP/POP3 server so in essence 10.3 has the same database structure as 10.5.

     

    There are however a few differences and possible speedbumps. First of all, when moving from a PPC to an Intel based server you will loose all read/unread flags (well there are ways around this, but they involve going through hoops and may not be worth it).

     

    That said, to make things go as smoothly as possible, you will need a license of 10.6 Server somewhere (doesn't matter if on the server to migrate from, to, or a different server under your control).

     

    1. Grab /usr/bin/cvt_mail_data and /usr/bin/cyrus/bin/cvt_cyrusdb from your 10.6 server

     

    2. Use the instructions found for migrating to 10.6 or 10.7 using migrate_mail_data.pl, but change any references to that script to the version found in 10.8: /Applications/Server.app/Contents/ServerRoot/usr/libexec/dovecot/migrate_mail_d ata.pl

     

    3. Run the script. It should look something like:

    sudo /Applications/Server.app/Contents/ServerRoot/usr/libexec/dovecot/migrate_mail_d ata.pl --cyrusBin "/path/to/binaries/grabbed/from/10.6" --database "/path/to/old/database/imap" --sourceSpool "/path/to/old/imap/spool" --targetSpool "/Library/Server/Mail/Data/mail"

     

    4. If all went well, your mailboxes have been migrated to Dovecot and are in the new location. However, since 10.6 had a different way of assigning mailboxes and permissions you need to rename the mailboxes from their current name to the GUID of the user. Assuming you have a mailbox called thomas, issue:

     

    /Applications/Server.app/Contents/ServerRoot/usr/bin/cvt_mail_data -i thomas

     

    This will return the GUID of the mailbox. Rename it using:

    mv thomas GUID (Replace GUID with actual GUID)

     

    Repeat for each user.

     

    5. When done, fix permissions:

    sudo chown -R _dovecot:mail /Library/Server/Mail/Data/mail

     

    And of course, clone your freshly installed 10.8 server before attemtping any of this. :-)

     

    Don't forget to keep fingers crossed ;-)

     

    HTH,

    Alex

  • 2. Re: Moving mail services from 10.3.9 to 10.8.2
    Stephen Thomas2 Level 1 Level 1 (10 points)

    The sticky part is I don't have a 10.6 server licence or even the install disks.

     

    In looking around I've found a utilty 'cyrus2dovecot' http://www.cyrus2dovecot.sw.fu-berlin.de/index.html that might be promising. Anybody use this before?

  • 3. Re: Moving mail services from 10.3.9 to 10.8.2
    Fred Turner Level 1 Level 1 (80 points)

    Stephen Thomas2 wrote:

     

    The sticky part is I don't have a 10.6 server licence or even the install disks.

     

    If you'd like to email me at <fred at c5consulting.net>, perhaps I can help you out w/ those 2 binaries. Can't imagine it should raise too big a stink, since you're straddling the version you need for the utils w/ your other 2 purchases.

     

    Fred

  • 4. Re: Moving mail services from 10.3.9 to 10.8.2
    pterobyte Level 6 Level 6 (10,910 points)

    cyrus2dovecot will work too. As would copying mail through an IMAP client. I'll ask my colleague Jeff if he has time to post cyrus2dovecot instructions as he has used it a few times more than myself.

  • 5. Re: Moving mail services from 10.3.9 to 10.8.2
    UptimeJeff Level 4 Level 4 (3,390 points)

    http://www.cyrus2dovecot.sw.fu-berlin.de/documentation.html

     

     

    IMPORTANT- This is based on notes from a migration a year ago.

    I copied the notes and edited without fully testing, there could be errors or omissions

    Considering this is not a proper tutorial and not fully tested - I would only attempt this if you are comfy in terminal and could troubleshoot any issues that come up.

    -------

     

    Mount old server

     

    Download cyrus2dovecot.pl.

    The directions below assume you place it in your home folder:

         ~/cyrus2dovecot.pl

     

    Edit the beginning of the cyrus2dovecot script to something like this:

            dovecot_inbox => '/Library/Server/Mail/Data/mail/%u',

            cyrus_inbox => '/Volumes/OldServer/var/spool/imap/user/%u',

            cyrus_sub => '/Volumes/OldServer/var/imap/db/user/%h/%u.sub',

            cyrus_seen => '/Volumes/OldServer/var/imap/db/user/%h/%u.seen',

     

    convert a single mailbox with

        sudo ~/cyrus2dovecot.pl username

     

    in 10.7 - 10.8 server, mailboxes are stored with the user's GUID

    The example above stores the mailboxes with username and puts them in /Library/Server/Mail/Data/mail/

    We'll need to rename those mailboxe to the proper GUID

     

    You can lookup a GUID for user=bob with

         sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/cvt_mail_data -i bob

     

    Stop mail, delete or rename any existing mailbox for the user

    An example below using default mailstore and random guid.

         sudo serveradmin stop mail

         sudo cd  /Library/Server/Mail/Data/mail/

    rename the existing 10.7/10.8 mailbox if it exists

         sudo mv 02E126CF-60CE-4044-800C-156431DA8E20 02E126CF-60CE-4044-800C-156431DA8E20.hold

    Then rename the converted mailbox for the user and set permissions

         sudo mv bob 02E126CF-60CE-4044-800C-156431DA8E20

         sudo chown -R _dovecot:mail 02E126CF-60CE-4044-800C-156431DA8E20

    Start Mail

         sudo serveradmin start mail

     

    Extras:

    You can batch convert users a list of users.

         sudo ls /Volumes/OldServer/var/spool/imap/user/ > ~/imap-users.txt

    Then run cyrus2dovecot.pl with the list of users

        sudo ./cyrus2dovecot.pl < ~/imap-users.txt

    You'll end up with all the users converted, you need to rename them to the proper GUID and chown when done.

     

    You could wrap all of this in a script that includes lookup of the user's GUID, rename directories, etc...

    But for the typical 5-20 user server, you could just as easily do this manually.

     

     

    *** there could be errors in the above.. its a rough guide

  • 6. Re: Moving mail services from 10.3.9 to 10.8.2
    victor.l Level 1 Level 1 (0 points)

    I was able to migrate mail from Mac OS 10.5.8 server to Server.app 2.2.2 using the binaries from 10.5.8. There is one major problem with the migrate_mail_data.pl script. It assumes the cvt_mail_data binary is in /usr/bin. On 10.8.5 with Server.app installed it's at /Applications/Server.app/Contents/ServerRoot/usr/bin/cvt_mail_data. Since the /usr/bin/cvt_mail_data path is hard coded, I modified the script.

     

    BTW, the script from Server.app 2.2.2 handles converting the mail box names to GUID.

  • 7. Re: Moving mail services from 10.3.9 to 10.8.2
    UptimeJeff Level 4 Level 4 (3,390 points)

    instead of modifying the script, you can symlink cvt_mail_date to the location where the migration script exects to find it...

     

    ln -s /Applications/Server.app/Contents/ServerRoot/usr/bin/cvt_mail_data /usr/bin/cvt_mail_data

     


  • 8. Re: Moving mail services from 10.3.9 to 10.8.2
    TigerKR Level 1 Level 1 (30 points)

    I don't suppose you genius wizzards have a guide like this for upgrading mail users from 10.6.8 server to 10.9 server?