Back Up and Restore a Zimbra CE Mailbox Using TGZ Exports

To back up one Zimbra Community Edition (CE) mailbox, export it as a TGZ file with zmmailbox getRestURL, validate the archive, and restore it with postRestURL. When importing into an account that already contains mail, begin with resolve=skip; using resolve=reset at the mailbox root can remove existing items.

Understand what a per-mailbox export protects

Zimbra documents TGZ export and import through its REST interface and zmmailbox utility. The archive is intended to carry mailbox content and folder structure, including email messages packaged as EML files and applicable calendar, contact, task, or Briefcase data. Exactly which content and metadata survive an import can depend on the source and destination versions and the items being transferred.

Do not confuse this with a full account or server backup. A TGZ content export does not provision a missing account or independently preserve all LDAP attributes, passwords, aliases, class-of-service assignments, routing settings, filters, grants, or server configuration. Record any needed account settings separately using administrative procedures. The zmbackup utility described in older Zimbra documentation belongs to Network Edition, not the standard CE workflow.

The command examples follow Zimbra’s documented interfaces, but they are not a live test of every independently built CE release. Check zmcontrol -v, available zmmailbox help, and your build’s release notes before planning a production recovery. A live REST export also should not be assumed to capture one perfectly consistent instant if the user changes items while it runs. Schedule a low-activity window when consistency matters.

Export the individual mailbox

1. Identify the account and its mail host

Connect to the Zimbra server with an administrator-capable operating-system account. Switch to the Zimbra service user, then confirm that the target account exists. In a multi-server deployment, make sure you are connecting to the correct mailbox service.

sudo -iu zimbra
zmcontrol -v
zmprov ga user@example.com zimbraMailHost zimbraAccountStatus
zmmailbox -z -m user@example.com getAllFolders

Replace user@example.com with the actual account. The -z switch uses local Zimbra administrator credentials; it is not the end user’s password. If you lack the necessary administrative rights, use an approved account-access workflow instead of embedding passwords in a shell command.

Terminal showing a Zimbra account lookup with mailbox host and active status
Check the mailbox address, hosting server, and account status before starting the export.

2. Create a private archive location

As a privileged OS user, create a location writable by the Zimbra service user. Do this outside publicly served directories and check free space first. Run the installation command before switching to zimbra, or return to your privileged account.

sudo install -d -o zimbra -g zimbra -m 0700 /srv/zimbra-mailbox-backups
df -h /srv/zimbra-mailbox-backups
ls -ld /srv/zimbra-mailbox-backups

Mail archives may contain confidential messages and attachments. Limit filesystem access, protect any off-server copy, and apply an appropriate retention policy.

Terminal showing a private mailbox-backup directory and Unix permission listing
Use a private backup directory and verify its filesystem permissions.

3. Export the mailbox as TGZ

From a zimbra shell, use the REST exporter below. The -t 0 option disables the CLI timeout for large operations; it does not guarantee that proxies, disk I/O, or server limits cannot interrupt the export.

umask 077
zmmailbox -z -m user@example.com -t 0 getRestURL '//?fmt=tgz' > /srv/zimbra-mailbox-backups/user-20261010.tgz

Run one export per account and choose a dated, unique filename. Do not reuse a previous archive path because shell redirection will truncate it. If the command reports an error, treat the resulting file as incomplete until it passes the checks below.

Terminal showing zmmailbox getRestURL exporting a mailbox to a TGZ file
The getRestURL command writes a compressed mailbox archive to the chosen directory.

4. Validate the archive and record its checksum

A nonempty TGZ file is not proof of a recoverable backup. Test the entire tar stream, inspect representative folder entries, and calculate a digest. A failed tar check means you should investigate the export rather than import the file.

test -s /srv/zimbra-mailbox-backups/user-20261010.tgz
tar -tzf /srv/zimbra-mailbox-backups/user-20261010.tgz > /dev/null
tar -tzf /srv/zimbra-mailbox-backups/user-20261010.tgz | head -n 20
cd /srv/zimbra-mailbox-backups
sha256sum user-20261010.tgz > user-20261010.tgz.sha256

Store the checksum beside the archive and move both to protected storage outside the original server. After copying, run sha256sum -c user-20261010.tgz.sha256 in the directory containing the two files. A successful checksum confirms byte integrity, not that every mailbox feature will restore correctly.

Terminal showing archive existence, gzip integrity, and a list of mailbox folders
Inspect the archive before treating the export as a usable recovery copy.
Terminal showing a SHA-256 checksum for a mailbox TGZ file
Record a SHA-256 digest so the transferred archive can be checked for changes.

Restore the archive without overwriting live mail

5. Prepare and inspect the destination mailbox

Create the destination account through your normal approved Zimbra provisioning process if it does not already exist; the TGZ import will not create it. Check its address, quota, service access, and existing folders. For the first test, use an isolated nonproduction account, especially for cross-version transfers.

sudo -iu zimbra
zmprov ga user@example.com zimbraMailHost zimbraAccountStatus
zmmailbox -z -m user@example.com getAllFolders

Copy the validated archive to a directory readable by the destination Zimbra service user, retaining restricted permissions. For a remote transfer, verify the checksum again at the destination. Do not assume an account with the same address is empty.

Terminal showing account attributes from the Zimbra provisioning command
Confirm that the intended destination account exists before importing mailbox items.

6. Import with a conflict policy that fits the destination

To add missing items while leaving matching items in place, use resolve=skip. This is the documented default duplicate-handling behavior, but it is not a promise of perfect merging for every item type or version.

zmmailbox -z -m user@example.com -t 0 postRestURL '//?fmt=tgz&resolve=skip' /srv/zimbra-mailbox-backups/user-20261010.tgz

Avoid copying a destructive example into production. Zimbra documents resolve=reset as clearing destination items before import. The replace and modify policies also change how existing items are handled. Only consider them for a controlled restoration after testing and obtaining approval for the exact account and folder scope.

Terminal showing zmmailbox postRestURL with the resolve=skip option
Import the archive with the skip conflict policy when existing mailbox content must be retained.

Handle export failures and verify the recovery

If you encounter a timeout, retain -t 0 and inspect the server or proxy timeout and storage limits; a zero CLI timeout does not resolve every network problem. Zimbra’s support wiki also warns about broken archives and I/O failures on some large mailbox exports. For an oversized or unreliable export, divide the work by folder or date, then test each archive and its import on a spare account.

For example, the documented search query under:Inbox selects Inbox content and its subfolders. The quotation marks around the REST URL are essential because the ampersand must reach Zimbra rather than the shell.

zmmailbox -z -m user@example.com -t 0 getRestURL '//?fmt=tgz&query=under:Inbox' > /srv/zimbra-mailbox-backups/inbox-20261010.tgz

A folder-scoped archive is not a substitute for the full mailbox export. Verify its contents independently and document which folders or dates were omitted. If the account is disabled or the request returns an authorization error, inspect account status and administrative authentication instead of bypassing TLS certificate checks or exposing credentials.

7. Verify the restored items, not just the command exit

List the destination folders and compare them with the recorded source folders and TGZ inventory:

zmmailbox -z -m user@example.com getAllFolders
zmmailbox -z -m user@example.com getMailboxSize

Then sign in to the destination test account and open a sample of received and sent messages, attachments, contacts, and calendar events. Check dates and folder paths, and review any import errors. Re-create or check aliases, sharing permissions, rules, and other account-level settings separately when required. Only treat the recovery as successful once the expected data is accessible and the checks are recorded.

Terminal showing Zimbra folder names returned by getAllFolders
Compare the restored Inbox, Sent, Calendar, and other folders with the expected archive contents.

Primary references: Zimbra zmmailbox command reference, Zimbra REST API reference, Zimbra zmprov administration reference, and Zimbra article on scoped exports and large-archive cautions. Some Zimbra wiki examples are older or marked work in progress; verify their behavior on your installed CE build before relying on them in production.

Leave a Comment

How to