How to take mailbox backup of Zimbra Account from CLI

A system administrator’s worst nightmare is the call, page, text message, or any other alarm informing you that the server is down. Especially when the server is very critical and instrumental to the organization, like a Zimbra Mail Server. This post discusses the backup and restores procedure of a Zimbra Account.

Mailbox backup from CLI Zimbra

1. Create a directory where you want to take backup:

# chmod 777 /backup

or:

# chown zimbra.zimbra /backup

2. Login from zimbra user and run below command to Export/Backup user mailbox:

# su - zimbra
$ zmmailbox -z -m user@example.com getRestURL "//?fmt=tgz" > /backup/user@example.com.tar.gz

Restore/Import Zimbra Mailbox backup

You can restore the Zimbra Mailbox from the backup taken as per above section. To restore a Zimbra Mailbox backup:

$ zmmailbox -z -m user@example.com postRestURL "//?fmt=tgz&resolve=reset" /backup/user@example.com.tar.gz
Note: You can change username and backup location as per your setup.
Related Post