Zimbra to Carbonio – Z2C

This is it. After more than a decade I had to install a different E-mail/Collaboration server than Zimbra.

Carbonio from Zextras is a great tool and if it still have a loot to improve it’s ready to go in production and full fill most users needs to replace Zimbra as a popular E-mail server.

Don’t fool yourself, Carbonio is a lot different and have many extra components, but it’s core still is a Zimbra., meaning that most “zm” commands are available and also it’s 4 pillars mysql + openldap + postfix + jetty still are there. What Zextra did so far was add a new interface, libreoffice and a service networking solution called Consult to help to integrate it all. It’s a pretty damn good work.

After many test in controlled environment I finally migrated my first server to Carbonio and I took inspiration o a very handy tool done by Fábio Schidt called Z2Z to make this scripts to help migrate from Zimbra to Carbonio.

In the end I realized that processes were not so different and with just a few adjusts it could also be used to migrate from Zimbra to Carbonio and vice-versa, but also from Z2Z and Z2Z =)

You can download it here: Z2C


Z2C is a quite simple pair of scripts to export LDAP data from an origin Zimbra or Carbonio server and import it on a brand new Zimbra or Carbonio server. It’s goal is to migrate accounts and help to dump and restore mailboxes from one server to another.

z2c.sh will not export any mailboxes mails, calendar, tasks or contacts it self. It creates the scripts to do so. After run it take a closer look at the export folder.

As simple as it is, there is no need for install anything. Just run the scripts:

1 – run z2c.sh to export it all from the original server
2 – copy the Z2C folder to the new server
3 – fix its permission on the new server
4 – run restore.sh to import it on the new server

Those steps will export users, aliases and lists from the origin server and import it on the destination server.


Once you have all domains, accounts, aliases and list imported on the new server it’s time to dump mailboxes on the original server, copy it to the new one and then restore it there.

Z2C makes it pretty easy for you, creating a full set of scripts:

script_export_FULL.sh   -> a list of zmmailbox commands to dump all mailboxes;
script_export_TRASH.sh  -> a list of zmmailbox commands to dump the Trash folder, because it's not dumped on the regular command and some users can't live without it's Trash
script_import_FULL.sh   -> a list of zmmailbox commands to restore all mailboxes;
script_import_TRASH.sh  -> a list of zmmailbox commands to restore the Trash folder, because it's not restored on the regular command and some users can't live without it's Trash 
script_import_quota.txt -> a list of zmprov commands to restore all accounts quotas if you need it;
users.txt               -> just a list of users to make it at hand in case you want to script anything #nerdfellings


You may consider to install and run those scripts using parallel to make dumps and restores faster.
Those scripts are great but it may take quite a long time to run it if you have hundreds or thousands of accounts, so be able to run many at the same time in a non stop way it’s faster, by far.

Just take care to don’t do too many at the same time, your server may not be able to deal with the overload. We suggest you to use between 3 and 5 simultaneously dumps/restore, but
feel free to test it out.

This is how you use it:

parallel -j4 < script

-j4 -> where 4 is the number of processes it will run at the same time;
script -> the name of that file with the list of commands you wanna it to process


Sometimes zmmailbox aborts processing with a “timeout” error despite the fact we’re using “-t0” flag option.
The workaround is change socket_so_timeout option to a very high time before start importing those mailboxes dumps and restore it’s default value when it’s over. So here you
have it:

zmlocalconfig -e socket_so_timeout=99999999
zmlocalconfig --reload

Then import it all

To restore default values do:

zmlocalconfig -e socket_so_timeout=30000
zmlocalconfig --reload

Error 500

When running import scripts you may see this error message:

ERROR: service.FAILURE (system failure: POST failed, status=500 500)

There is nothing to worry about. That error happens because it is trying to import an empty file. When Z2C export data from Zimbra, some files get no content and end empty.

Wish it helps!

1 comentário em “Zimbra to Carbonio – Z2C”

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *