How to take mailbox backup of Zimbra Account from CLI

Mailbox backup from CLI Zimbra
Create a directory where you want to take backup
# chmod 777 /backup
or,
#chown zimbra.zimbra /backup

Login from zimbra user and run below command to Export/Backup user mailbox
Export/backup Zimbra mailbox 
#su - zimbra
$ zmmailbox -z -m user@example.com getRestURL "//?fmt=tgz" > /backup/user@example.com.tar.gz

Restore/Import 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 .
Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

5 comments:

  1. Hi, I use this command as zimbra:

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

    but i get error ERROR: zclient.IO_ERROR (invoke Connection refused, server: localhost) (cause: java.net.ConnectException Connection refused)

    Thanks & Best Regards,
    Syarbel Budiman

    ReplyDelete
  2. It's seems like you mailbox or other service stopped on Zimbra Mail server. Could you please check the service status from command: zmcontrol status
    All services should run on server if anyone is stopped, start service using command: zmcontrol restart

    ReplyDelete
  3. Please tell me, how to take zimbra backup with "from" and "to" date mentioned. ie I need to backup 01/07/2020 to 31/07/2020 mail data using command.

    ReplyDelete
  4. This is very helpful, thank you. There is one question thought, can create a backup from different version of zimbra and then restore to a newly installed zimbra. Lets say like creating a backup from mailbox contained on zimbra 8.5 and using the restore method to put the new zimbra 8.8? (and if it can be done, does the account user password also follows? (im planning on upgrade my version of zimbra, but i want to retain all those user's setting and credentials).

    ReplyDelete