Restore Zimbra, OSE, from backups
This morning I thought to take advantage of the long weekend and update my Zimbra installation – this didn’t go as well as expected. Instead I ended up with a corrupted server. I was left spending the morning restoring from my latest zmback.sh backup.
The process was simple enough, but since I couldn’t find a clear step-by-step guide I thought having an easy to find reference guide would be of use in the future – as I’m sure I’ll be in a simliar possition again one day.
I perform regluar backups of my Zimbra server using the zmback.sh script which produces a full backup of a Zimbra instance, rather than simply backup users mailboxes. The script is available from the Zimbra forum, how its quite a long thread.
Since my problems started after a Zimbra upgrade the first thing to do is uninstall Zimbra.
Next we need to determin the latest backup archive. zmback.sh creates a full backup and subsiquent differential backups. My lastest backup archive was 10_ZimbraBackup_20180328_FULL.txt.gz with 1 differential back up from last night.
Next we have to make sure the installed version is the same as the one your restoring from. Since Zimbra stores a note of installed files we can get that from the archive
dar -x /media/backup/10_ZimbraBackup_20180328_FULL -g .install_history
Knowing what version to install you can download the correct version from Zimbra. Once downloaded follow the install guide and install Zimbra – it doesnt matter what settings and options you enter during the installation since we will be overwriting everything anyway.
Now the system is ready we can do the actual restoration work. First thing is to move the current zimbra folder aside then create a new folder for dar to restore too. Then tell dar to restore from your backup.
mv /opt/zimbra /opt/zimbra_prerestore
dar -w -x /media/backup/10_ZimbraBackup_20180328_FULL -R /opt/zimbra -b
dar -w -x /media/backup/10_ZimbraBackup_20180329_DIFF -R /opt/zimbra -b
And your done. Everything should now be back to where it was before things went to the dogs