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=skip' folder/file-location.tgz";
resolve = skip. This parameters will keep mailboxes existing on users.
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 email@example.com postRestURL '//?fmt=tgz&resolve=skip' /firstname.lastname@example.org";
The above command will be restore backup mailboxes email@example.com user with reset resolver and the backup file is located in /firstname.lastname@example.org
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=skip' $BACKUPDIR/$NAME.tgz"; done echo "All mailbox has been restored sucessfully"
Good luck and hopefully useful 😀