Zimbra Migration with Zextras Backup

How to migrate Zimbra using Zextras Backup

Learn how to migrate Zimbra: Zextras Migration Tool is no longer available, this guide will help you to perform a migration using Zextras Backup.

Some Features

  • It’s specifically designed for a production environment.
  • It is designed to run test simulations/migrations, which by the way we suggest running

Please note that all the CLI commands in this guide must be executed logged in as the Zimbra user unless otherwise noted.

What Will be Migrated?

  • Email and email folders
  • Contacts and address books
  • Appointments and calendars
  • Tasks and task lists
  • Drive Files
  • Share informations
  • User preferences
  • User settings including password, identities and signature
  • Class of Service settings
  • Domain settings, including domains certificate

What Will NOT be Migrated?

  • Server configuration
  • MTA / Proxy config
  • Customization like banners, logos, etc
  • LDAP configuration

Scenarios

Depending on the number of mailstore in the source and in the destination infrastrucutre , several scenarios could occur:

  • Starting from one server and arriving to one (The one you will find in this article)
  • Starting from “n” servers and arriving to one
  • Starting from one server and arriving to “n” ones
  • Starting from “n” servers and arriving to “m” ones (eg. from 5 to 3)
  • Migration of only one subset of domains

To describe process in clear way, this article will cover the first one, even if the same logic could be applied to other scenarios and will be covered in future articles.

Destination infrastructure must be installed and operating (in particular LDAP, NGINX, MTA).

Some Checks before starting migration

Servers

As we have seen above, any Zimbra server can be the source of your migration, provided that it’s running Zextras Backup or Zimbra Suite Plus and, at the same time, any Zimbra server can be the destination of your migration, as long as it’s running Zextras Backup.

Storage

Make sure to have an amount of free disk space comparable to the size of the /opt/zimbra/store/ folder.

On the destination server, on the other hand, make sure you have more free space than the size of the /opt/zimbra/store/ and export folders on the source server combined. You need space for source backup, store and destination backup. Here is an example to better explain:

If we have 100GB used by /opt/zimbra/store and 80GB of /opt/zimbra/backup/zextras on the source server , on the destination server we need at least 100GB for /opt/zimbra/store , 80GB for the source backup and additional 80GB for the new /opt/zimbra/backup/zextras

Data Transfer

The easiest method to choose for data transfer is rsync, because it’s a good balance between speed and convenience, although you can choose to do so in any other way.

Transfer can be executed while source is up and running. Considering the structure of zextras backup, tools like Rsync allow to transfer only the delta, allowing an incremental transfer that keeps the source and destination constantly updated.

The main data transfer is executed while the source server is still active and functional; anyway, since the process is performed via network, be sure to plan your transfer in advance so that all your data have been transferred before migrating.

You can also, for sure, choose alternative ways to transfer your data.

DNS

Set the TTL value of your MX record to 300 on your real DNS. Do the same also on AName/Cname of the webui , if the source and the destination must use the same address. This will allow a fast switch between source and destination servers.

Coherency Checks

To avoid any possible data-related issues, it’s important to run the following checks on the source server:

zxsuite powerstore doCheckBlobs – This is going to check the congruity between Zimbra’s metadata and BLOBs

/opt/zimbra/libexec/zmdbintegrityreport -v – This one is used to check the integrity of the Zimbra database.

After these two tests, we will proceed repairing any errors we found and then we suggest to run a reindex of all mailboxes.

Zextras Backup Setup

First of all make sure that Zextras backup is active on source system.

On destination server, disable real time scanner (since it would result in a backup of the backup we are importing and is clearly not needed):

zxsuite config server {server_name} set attribute ZxBackup_RealTimeScanner value false

Please note that it is strongly recommended to have a dedicated device for the data export. This will let you impove the export performance and lower the impact on the performances of the running system.

SmartScan

Now it’s time to run a SmartScan on the source server adding the deep option with the following command:

zxsuite backup doSmartScan start deep true

Then all your data will be exported to the default backup path (/opt/zimbra/backup/).

Data Synchronization

When you move the exported data to the destination server, make sure that the destination folder is not Zextras Backup’s backup path on the destination server to avoid any trouble if you already use Zextras Backup or plan to do so on the destination server.

With rsync, copy the data contained in the /opt/zimbra/backup/ onto a directory in the destination server (please make sure the Zimbra user has r/w permissions on that folder). It’s better to use a terminal multiplexer like screen or tmux and note that the process might need A LOT of time depending on network speed and amount of data involved.

The following command must be executed as root (and not as Zimbra user):

rsync -avH /opt/zimbra/backup/ root@desinationserver:/path/for/the/data/

Since source server is active and the realtime scanner enabled, more new data can be added to the backup path. Repeat this operation as many time as needed, to reduce the amount of data to be syncronized in the last step

Import

It’s now time to import all the data we exported to the destination server. Target server is up and running and backup is active with the realtime scanner disabled.

For first run a Provisioning Only import that will only create Domains, classes of service and accounts on the destination server, skipping all mailbox contents. This is possible through the following command:

zxsuite backup doExternalRestore /path/for/the/data/ provisioning_only TRUE

After this first step, switch the mailflow to the new server. Now destination server can receive mail and let users login with their old credentials. In the meanwhile old emails are being restored.

When it is completed, execute the Rsync another time, to recover the latest email added in the source server and then will be the time to start the  import of blobs and items:

zxsuite backup doExternalRestore /path/for/the/data/ concurrent_accounts <number>

The concurrent_accounts parameter allows you to restore multiple accounts at the same time, thus greatly speeding up the restore process.

At the end of importing, it is possible to perform additional SmartScan on source (deep attribute is no longer needed) and another rsync to copy on destination server any other emails arrived during the switch and run again the import command, which will import only the new items.

If you have little data or don’t want to run the two steps, you can switch the MX record and then run everything with just the command below:

zxsuite backup doExternalRestore /path/for/the/data/ concurrent_accounts <number>

Do not edit or delete the backup path after this step

Post-Migration Checks

Now that migration process is completed, we are going to perform some checks to be sure that everything is working fine.

First of all we are checking for inconsistencies with shares:

zxsuite backup doCheckShares

In case this command report any inconsistency, we can fix any broken share writing as follows:

zxsuite backup doFixShares

Mapfiles can be found in the Backup Path of the destination server as map_[source_serverID].

Galsync

First of all delete any imported GalSync accounts from the Zimbra Administration Console and then, if needed, create new GalSync accounts on all the imported domains and resync all the GalSync accounts using the following command:

zmgsautil forceSync -a galsync.randomstring@domain.com -n [resourcename]

Last steps

It is highly suggested to run a Volume Deduplication using Zextras Powerstore module after migration.

Now that everything is completed and works fine, Initialize Zextras Backup on the new server to make sure all of your data is secure.

TIPS

  • How many concurrent? It depends on your system. Our suggestion is to do a test import. It has no impact on the source and will allow you to evaluate the timing and performance of the destination. Start with a value equal to half of the available CPU cores and increase it if performance allows. (also check the disk output)
  • DO NOT modify the backup “map” files. If it happens that they become corrupted, it is better to delete the data and re-import the backup, to avoid duplicate items.
  • Every time you execute the import, the data of the domain and accounts are overwritten. Therefore in this phase is advisable not to make changes to the domain and do not change the preferences of users. Performing tests beforehand allows you to reduce this window of time as much as possible

Comments

Roykato
26/04/2021 1

Hi, In a server with multiple domains, is it possible to backup only a specific domain ? I want to migrate domain.com from server A to server B but not the others domains that are on server A, Thanks

Arman Khosravi
26/04/2021 1

Posted by: @Roykato

Hi,

In a server with multiple domains, is it possible to backup only a specific domain ?

I want to migrate domain.com from server A to server B but not the others domains that are on server A,

Thanks

Hi Roykato,

Sure you can! There are several options to achieve this goal.

  • you can use a defined set of COS for a specific domain (take a look at the Admin feature) and limit the Backup to this set.

  • you can use the domain parameter of the doExport command to export only a specific domain and later import the domain on another server.

  • you can use the domain parameter of the doExternalRestorecommand to import only a specific domain on the destination server.

I hope this helps you.

 

Roykato
29/04/2021 0

Hi ! Thank's a lot for your answer ! So for now I was able to fully move a backup from server A to server B but I might have gone wrong by doing another deep scan (instead of a regular scan) before migrating the mails that arrived in server A during the migration because it is re-importing all the mails (so there's a duplicate of all mails) on server B instead of only the new ones. I also encounter some command error with the commands that are on the post but it might be related with the version of zextras on the server (old server so zextras is not up to date). Thanks again !

trigg3r
15/06/2021 0

Instead of synchronizing the backup data between folders on the source and destination servers, how about using a NAS share mounting it to ''/opt/zimbra/backup/zextras/export'' on the source server and to ''/opt/zimbra/backup/zextras/import'' to the destination server?

Post your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

How to Install Zextras Theme for Zimbra
Zextras Backup