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";
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 firstname.lastname@example.org postRestURL '//?fmt=tgz&resolve=reset' /email@example.com";
The above command will be restore backup mailboxes firstname.lastname@example.org user with reset resolver and the backup file is located in /email@example.com
For restore backup all user, you could make a script as below :
#!/bin/bash BACKUPDIR="/srv/backup/20150128"; clear echo "Retrieve all zimbra user name..." USERS=`su - zimbra -c 'zmprov -l gaa | sort'`; for ACCOUNT in $USERS; do NAME=`echo $ACCOUNT`; echo "Restoring $NAME mailbox..." su - zimbra -c "zmmailbox -z -m $NAME postRestURL '//?fmt=tgz&resolve=reset' $BACKUPDIR/$NAME.tgz"; done echo "All mailbox has been restored sucessfully"
Good luck and hopefully useful 😀