Jump to content

Zimbra Restore Mails From Store Folder: Difference between revisions

From TetraWiki
No edit summary
No edit summary
Line 1: Line 1:
Zimbra Mailbox Structure
Mails are stored in
In Zimbra, each user is assigned a unique 'mailbox ID', which links him/her to


Go to the backup store folder:
Go to the backup store folder:

Revision as of 12:02, 25 July 2012

Zimbra Mailbox Structure

Mails are stored in In Zimbra, each user is assigned a unique 'mailbox ID', which links him/her to


Go to the backup store folder:

cd /opt/zimbra/store.old/0

Use the following script:

#!/bin/bash

for line in `ls`; do
echo $line >> /tmp/messagelist
cat $PWD/$line/msg/0/* | grep To: | sed 's/To: //' | sort | uniq -c | sort -nr | head -5 >> /tmp/messagelist
echo "" >> /tmp/messagelist
done

This will return a list of top ten users (in /tmp/messagelist) whose name is present in the 'To:' field of the messages stored. Using the output of this, we can make a good estimate of the user's folder, but this needs to be confirmed manually as well, by reading the email.


The mails can then be recovered by using zmmailbox as the Zimbra user.

Both the commands below give admin rights on zmmailbox prompt, so use any one.

zmmailbox -zadmin

or

zmmailbox adminAuthenticate -u https://server.domain.com:7071 admin@domain.com password

After that we create the 'Recovery' folder, and add messages to that folder from our old store folder.

mbox> selectMailbox agmadmin@witalsee.com
mbox agmadmin@witalsee.com> createfolder /Recovery
mbox agmadmin@witalsee.com> addMessage /Recovery /opt/zimbra/store.old/0/809/msg/0

/opt/zimbra/store.old/0/809/msg/0 is the path to the folder containing the mails. Some IDs may have a large amount of mails, resulting in msg/1, msg/2, etc. These will have to be run one-by-one.