Powered by Blogger.

Zimbra Tips : How To Restore Zimbra Mailbox

After success backup mailbox as described from previous article on this section : Zimbra Tips : How To Backup Mailbox Daily, Weekly and Monthly, you could restore the backup mailboxes with zmmailbox command who has been provided by Zimbra. The example command is like below :
su - zimbra -c "zmmailbox -z -m username postRestURL '//?fmt=tgz&resolve=reset' folder/file-location.tgz";
Note :
resolve = reset. This parameters will delete mailboxes existing on user and will be changed with mailbox backup. The reset parameter could be changed with skip, replace, modify.
folder/file-location.tgz is folder/file location backup mailboxes.
su - zimbra -c "zmmailbox -z -m admin@example.com postRestURL '//?fmt=tgz&resolve=reset' /srv/backup/20150128/admin@example.com.tgz";
The above command will be restore backup mailboxes admin@example.com user with reset resolver and the backup file is located in /srv/backup/20150128/admin@example.com.tgz
For restore backup all user, you could make a script as below :



echo "Retrieve all zimbra user name..."

USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;

for ACCOUNT in $USERS; do
echo "Restoring $NAME mailbox..."
su - zimbra -c "zmmailbox -z -m $NAME postRestURL '//?fmt=tgz&resolve=reset' $BACKUPDIR/$NAME.tgz";
echo "All mailbox has been restored sucessfully"
Good luck and hopefully useful 😀
    Blogger Comment
    Facebook Comment