Moving ZCS to Another Server

By | October 9, 2007

In this Zimbra Administrator’s PowerTip, we’ll discuss how to move your instance of Zimbra to another machine. It applies to all version of Zimbra.



Administrator’s PowerTip
#4: October 09, 2007
Zimbra ForumsZimbra wikiZimbra
Blog
Introduction


Either you, or someone you know has been there. Almost out of Disk space, RAM is topped out, and the CPU is constantly running above 80%. It’s time to upgrade the hardware. But how easy and safe is it to move the Zimbra server instance? Well, it’s easier than you might think.

In this Zimbra Administrator’s PowerTip, we’ll discuss how to migrate your Zimbra server to another Machine or OS. The one big caveat is that both instances of Zimbra MUST be running the same version. So if your old server is running 4.5.5, then you’ll need to install 4.5.5 on your new server. This wouldn’t be the time to upgrade your ZCS version.

Part 1 : Backing Up


Zimbra Network Edition contains a backup feature, and although it’s useful, we won’t be using it in this tip.

We have an external Hard Disc mounted to /mnt/migration. When rsync’ed, this is now your live copy (although it’s not live), and you should always have a backup of your live data. So, you might want to rsync again to another location to be safe.

Once you’ve rsync’ed all your data, umount the external drive, and put it somewhere safe.

 

Part 2 : Meet Your New Server


The only thing that really matters on your new server, is whether or not meets Zimbra’s server Hardware and the Operating System requirements.

It’s also very important that you have resolved any dependency issues. The ZCS installer for your newer OS should check for these.

Setup the newer server with the old server’s networking attributes. Make sure your older server is offline.

If changing the hostname, please see this wiki article: Set zmhostname

 


Part 3 : Create a “dummy” Install Then Remove It


The goal of this step is to get the rpm/dpkg databases correct. When you download ZCS, make sure it’s for your newer OS, and the SAME version of ZCS that’s rsync’ed.

Run the installer with the -s option. This tells the installer to only install the software, and not to configure the installation.

Once the installer has completed, delete it by rm -rf /opt/zimbra. This wipes any dummy data you have in that location.

 


Part 4 : Mount Your Backup HD, rsync, and Install


Connect and mount your external hard drive. Then, rsync the backed up data to its new location (rsync -avH /mnt/migration/zimbra /opt).

Connect and mount your external hard drive. Then, rsync the backed up data to its new location (rsync -avH /mnt/migration/zimbra /opt).
Unmount your backed up copy, and keep it in a safe place.
Now that our data is all in place, we need to fix some permissions. Go into the /opt/zimbra/libexec directory and run zmfixperms. This helps insure that all the files are owned correctly.
If uid/gid’s aren’t the same on both systems (see /etc/passwd and /etc/group) than you may need to modify /opt/zimbra/conf/localconfig.xml
If changing arch (32 to 64) see also http://blog.zimbra.com/blog/archives/2007/05/exporting-and-importing-zimbra-ldap-data.html and/or http://wiki.zimbra.com/wiki/Moving_ZCS_to_New_Server
Once that has completed, re run the installer that you downloaded. It will detect ZCS already installed, and ask if you want to upgrade. Select Yes.


Comments

  • I have successfully used the above procedure to migrate a ZCS 6.0.5 Open Source Edition from Debian 5.0 amd64 to CentOS 5.4, but had to fix a problem with unresolved symbols after doing so.

    After getting all the dependencies right (I installed with packages –nobase in kickstart file to have a real slick CentOS without all kinds of stuff that one never needs on a Zimbra server anyway), I had to manually remove this directory:

    /opt/zimbra/zimbramon/lib/x86_64-linux-gnu-thread-multi/

    This directory is just called “/opt/zimbra/zimbramon/lib/x86_64-linux-thread-multi/” (without gnu) when you install Zimbra on RHEL/CentOS 5. If it’s still there, Zimbramon will include stuff from the directory containing “gnu” first, and you will get unresolved symbol errors.

    Regards,
    Stijn

    Commented on March 28, 2010 at 1:42 PM
  • Hi all
    I’m Zimbra 6.06 user and I have a query/

    The first time I installed zimbra, I did.

    # ./install.sh –platform-override
    (and blablabla)

    Then, if I will install a new server for migrate my older, After Download, Should I do

    # ./install.sh -s
    (with the –platform-override option)

    Example

    # ./install -s –platform-override
    (or only)
    # ./install -s

    Later you say
    “”Once that has completed, re run the installer that you downloaded. It will detect ZCS already installed, and ask if you want to upgrade. Select Yes.””

    This is

    # ./install.sh –platform-override or only
    # ,/install.sh

    Thank You

    Commented on May 10, 2010 at 9:04 PM
  • Wonderfull tutorial, i have succeed moving my zimbra to a new machine.

    Thank you

    Commented on May 23, 2010 at 10:34 AM
  • Nice tutorial, but how can I do a similar procedure, but moving from a single server install to a brand new multiserver installation?

    Any tip/idea/tutorial?

    Thanks a lot.
    Ivan

    Commented on June 3, 2010 at 8:39 PM
  • Thanks for the article. Here are some of my observations

    zmfixperms does not fix permissions for all the folders (newer versions of zimbra). you have to run “zmfixperms -extended” command. Even then the permissions for /opt/zimbra/.ssh is not fixed. You need to fix that manuaaly using chowm command.

    Commented on June 4, 2010 at 6:34 AM
  • ./install.sh -s –platform-override option is working.

    Nice tutorial.

    Thanks
    Arun

    Commented on June 16, 2010 at 1:45 AM
  • Very nice tutorial.
    Amar is right, the zmfixperms doesn’t fix all the permissions.

    I had troubles with the zimbra store, so I had to fix them manually with the command (as root)

    # chown -R zimbra:zimbra /opt/zimbra/store/

    [spanish]
    Excelente tutorial.
    Amar tiene razón, el comando zmfixperms no soluciona todos los permisos.

    Tuve problemas con el Zimbra store, así que tuve que corregirlos manualmente con el comando (como root)

    # chown -R zimbra:zimbra /opt/zimbra/store/

    Commented on July 16, 2010 at 2:57 PM
  • This was just what I needed. I set my second server up with a different IP initially and did the rsync over SSH directly from the old to the new -

    rsync -r -a -v -e “ssh -l root” –delete /opt/zimbra/ :/opt/zimbra/

    then shutdown my old server and changed the IP address of the new server. Worked great!
    Thanks.

    Commented on August 10, 2010 at 11:48 PM
  • This was just what I needed. I set my second server up with a different IP initially and did the rsync over SSH directly from the old to the new -

    rsync -r -a -v -e “ssh -l root” –delete /opt/zimbra/ my-new-server-IP:/opt/zimbra/

    then shutdown my old server and changed the IP address of the new server. Worked great!
    Thanks.

    Commented on August 10, 2010 at 11:49 PM
  • Excellent tutorial, worked great for 32bit OS migration, but u need to be very cautious when playing between 32bit and 64bit OS

    Commented on August 20, 2010 at 3:13 AM
  • I have moved servers (unbuntu 6.x –> 8.x) and been able to move the mail from old to new server on v 5.1x. However, when I attempt to upgrade to any newer version, once the upgrade is completed, and Zimbra is running (zmcontrol status shows all functions working) I am unable to login to the site via browser, and it does not process mail.

    I am at a loss of why this is happening. I’ve tried a step to 6 directly, and also up to 5.24 form 5.13 with no luck.

    Is this related to an issue with the transfer to new machine, or with the ugprade process itself.

    Commented on August 21, 2010 at 2:39 PM
  • Hello,

    I followed all the procedures, but to rerun the install.sh command (without-s) is I get the following error:

    Restoring existing configuration file from /opt/zimbra/.saveconfig/localconfig.xml … done
    Operations logged to /tmp/zmsetup.09232010-130655.log
    Upgrading from to 6.0.4_GA_2038
    Stopping zimbra services…done
    Starting musql…done
    ERROR 1033 (HY000) at line 1: Incorrect information in file: ‘./zimbra/config.frm’
    Thu Sep 23 13:08:45 2010: Error while running ‘/opt/zimbra/bin/mysql –user=zimbra –password=XXXX –database=zimbra –bach –skip-column-names’

    Any suggestions? Tanks.

    Commented on September 23, 2010 at 6:23 PM
  • this proceduce works nicely , only two advices extracted from my expierences…

    1.- first of all verify your external disk… i’ve to the rsync process twice , cause the enclosure fails when it plug it into the destination machine…
    2.- coment out or disable all zimbra’s crond tasks, our if you prefeffer delete and write it down when the system going well.
    i mean , after the install.sh -s end’s
    as root : crontab -l -u zimbra > /some/place/zimbra.crontab
    as root : crontab -r -u zimbra
    as root: /etc/init.d/crond reload (only for mental health)
    after all goes nicely (zimbra’s restore procedure ends)
    as root : crontab -u zimbra /some/place/zimbra.crontab
    as root: /etc/init.d/crond reload (only for mental health)

    Commented on November 21, 2010 at 2:55 AM
  • Hai

    I tried this tip for migrating zcs6.0.5. It’s working fine

    Thank you

    Loganathan

    Commented on February 18, 2011 at 11:36 AM
  • I’ve done this several times with version 7 (7.0.1 & 7.1.3 if memory serves correctly), and it has worked every time, so long as I did the ‘zmfixperms -extended’ command.

    Commented on January 24, 2012 at 1:48 PM
  • Hi

    Works flawlessly.

    Release 7.1.3_GA_3346.UBUNTU10_64 UBUNTU10_64 FOSS edition

    Thank You

    Commented on February 7, 2012 at 5:48 AM