ZNG Restore Single Item from backup

Revision as of 14:20, 2 September 2017 by Shanxt (talk | contribs) (→‎Restore a single message/item from backup [ZNG ])
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Restore a single message/item from backup [ZNG]

   KB 23507        Last updated on 2017-09-2  

(0 votes)

What is Item Restore?

Item Restore is one of the Restore Modes of Zimbra Backup. A single item is restored from the backup store to the owner's account. Any type of item can be restored this way.

To do so:

  1. The item Id for the deleted item is obtained
  2. The item is then restored from the backup

How to get the Item Id

The item ID is a unique code that identifies an item in a mailbox. This can be obtained from the /opt/zimbra/log/mailbox.log file of the user's mailstore server.

Following are the log entries for a message moved to Trash:

2017-08-24 17:02:17,564 INFO  [qtp649734728-11841:https:https://mail.example.com:8443/service/soap/ConvActionRequest] [name=user@example.com;mid=6;
ip=;port=58892;ua=ZimbraWebClient - FF54 (Mac)/8.8.1_GA_1782;] mailop - Moving VirtualConversation (id=-259) to Folder Trash (id=3).  Affected message ids: 259.

Following are the log entries for a message which was deleted from Trash as well:

2017-08-24 17:02:42,177 INFO  [qtp649734728-11851:https:https://mail.example.com:8443/service/soap/ConvActionRequest] [name=user@example.com;mid=6;
ip=;port=58892;ua=ZimbraWebClient - FF54 (Mac)/8.8.1_GA_1782;] mailop - Deleting Message (id=259).

In both cases we can see the item id is 259

Locate the Item id in user's backup

We can now confirm if the item exists in the backup, or directly skip to the next step to try a restore without confirmation.

Along with all other metadata, item ID is stored in a file inside the "items" directory of the proper account in Zimbra Backup's datastore. The exact location of the directory is

[backup path]/accounts/[accountID]/items/[last 2 digits of itemID]/[itemID]

For example, the location of Item 259 of account 2ecc9758-b871-4db0-a37e-86311535d4fc, when using default backup path is:


Metadata are stored in a plaintext file, so tools like `grep` and `find` can be used to search for contents within the file. In order to see the metadata contained in a file in a more readable format you can use the `zxsuite backup getItem` command:


zxsuite backup getItem {account} {item} [attr1 value1 [attr2 value2...]]


NAME              TYPE               EXPECTED VALUES            DEFAULT
account(M)        Account Name/ID                               
item(M)           Integer                                       
backup_path(O)    Path                                          /opt/zimbra/backup/zextras/
dump_blob(O)      Boolean            true|false                 false
date(O)           Date               dd/mm/yyyy hh:mm:ss|all    last

(M) == mandatory parameter, (O) == optional parameter

For example, to see an item with id = 259 belonging to account 2ecc9758-b871-4db0-a37e-86311535d4fc, run:

zxsuite backup getitem  2ecc9758-b871-4db0-a37e-86311535d4fc 259

       start_date                                          24/08/2017 17:02:44
       type                                                message
       deleted                                             true
       metadata path                                       /opt/zimbra/backup/accounts/2ecc9758-b871-4db0-a37e-86311535d4fc/items/59/259.del
       blob path                                           /opt/zimbra/backup/items/qK/qKZr5fpqK45tqS9mne1vMsucPL,iR4eGPRtwNfVEJkc=
       last modified                                       01/01/1970 05:30:00
       sender                                              admin@mail.example.com
       recipients                                          sandesh
       subject                                             Hardworking Person
       conversation id                                     -259
       fragment                                            This is an email for Restore Item.

To restore the item

Now that the item has been confirmed to exist, we can restore it by simply running:

zxsuite backup doItemRestore user@example.com 259 restore_folder /Inbox

Here any folder besides 'Inbox' can be used.

Jump to: navigation, search