Platform and OS Independent ZCS to ZCS Migration Using Rsync
This is a method for ZCS to ZCS migration that preserves all settings and user accounts. It may work across differing OSs and hardware platforms, including 32 bit to 64 bit server migrations. While it has been tested by Zimbra staff and customers, this documentation is community contributed, and is not certified Zimbra documentation.
While it may be possible to to move between different Operating Systems using rsync, we have not tested every combination, and some may fail due to various incompatibilities.
IT IS PREFERRED TO USE THE SAME LINUX DISTRIBUTION AND RELEASE. FAILURE TO DO SO CAN RESULT IN ERRORS.
MIGRATING PRODUCTION SERVERS WITHOUT TESTING CAN RESULT IN PRODUCTION OUTAGE.
WE STRONGLY ENCOURAGE performing a test run of the process using a virtual machine or non-production server. This would require a small downtime window while the last rsync is performed.
IMPORTANT Please review this important background information. Should you encounter difficulty, it will be important to know what you are actually doing. This wiki is meant to provide the steps in a simplified manner, but it is NOT meant to replace the following documentation.
Install Zimbra packages on new host
rsync /opt/zimbra from old host to target host
Import LDAP data
Run Zimbra installer to upgrade files in /opt/zimbra
Install the exact same release of ZCS on the new server using the -s flag. Use the 64 bit version if you are migrating from 32 to 64 bit.
Remove /opt/zimbra on new host.
Rsync /opt/zimbra from the old server to the new server. This can be done several times prior to the move date to save time.
On move date-
Stop services on old server and complete last rsync to the new one.
Repair permissions on the new server.
Make a backup of the LDAP and scp it to the new server.
Rename new server to old host name. Change IP on new host to old IP or change DNS and allow to propagate.
Restore the LDAP from backup.
Bring new server online.
Some more detail:
Install the just the packages on new host.
Remove /opt/zimbra on new host.
rm -rf /opt/zimbra
On old host, rsync /opt/zimbra AS ROOT to the new host.
nice -n +19 rsync --progress -avzHS -e ssh /opt/zimbra/ root@NEWHOSTIP:/opt/zimbra
STOP SERVICES ON OLD HOST. Failure to stop services can result in data corruption on the target host.
Perform last rsync as root on old host.
nice -n -20 rsync -avzHS -e ssh --delete --progress /opt/zimbra/ root@NEWHOSTIP:/opt/zimbra
Repair permissions on new host.
/opt/zimbra/libexec/zmfixperms --verbose --extended
Export the LDAP data on the old host:
a. Create an LDAP dump directory. As root, type:
b. As root, type:
chown zimbra:zimbra /backup
c. Backup the LDAP data, as zimbra, type:
d. Backup LDAP config data, type:
/opt/zimbra/libexec/zmslapcat -c /backup
e. On new host, do:
f. From old host, copy over the ldap.bak file:
scp /backup/ldap.bak firstname.lastname@example.org:/backup
g. From old host, copy over the ldap-config.bak file:
scp /backup/ldap-config.bak email@example.com:/backup
Rename new host to old name and change IP. If you are not changing the IP, make sure that you have updated DNS and that the hostname resolves to the correct IP. (This varies by distro- /etc/hosts /etc/sysconfig etc). You may want to reboot the host just to be sure the name change takes.
Restore the LDAP data to the new server:
a. Delete the ldap config:
b. Move the ldap hdb directory:
mv /opt/zimbra/data/ldap/hdb /opt/zimbra/data/ldap/hdb.old
c. Create the hdb directory structure:
mkdir –p /opt/zimbra/data/ldap/hdb/db /opt/zimbra/data/ldap/hdb/logs
d. Copy the DB_CONFIG from hdb.old to hdb:
cp /opt/zimbra/data/ldap/hdb.old/db/DB_CONFIG /opt/zimbra/data/ldap/hdb/db/DB_CONFIG e. Set permissions: chown -R zimbra:zimbra /opt/zimbra/data/ldap
Import the LDAP configuration and data files:
/opt/zimbra/openldap/sbin/slapadd -q -n 0 -F /opt/zimbra/data/ldap/config -cv -l /backup/ldap-config.bak
/opt/zimbra/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config -cv -l /backup/ldap.bak
this time without the -s flag. This will upgrade the files under /opt/zimbra that need to be corrected for the new hardware. Select Y to upgrade. Do not check the database.
Some users have reported that they needed to update the ssh keys after starting the new server:
Make sure that the UID for the zimbra user is the same as before. If it has changed, edit /etc/passwd to make it match the zimbra user UID on the old server.
Now your /opt/zimbra/* is the same on both hosts (or upgraded for new hardware by install.sh), and you have imported the LDAP DB, your hostname should be the same as before. You should be able to start Zimbra on the new host.
Note for Ubuntu users: Some users have reported issues with the slapadd commands failing on the new server due to the inability of 64 bit Ubuntu to run the old 32 bit slapadd command copied from the old server. One possible workaround is to install the 32 bit runtime libraries on the new server.
apt-get install ia32-libs