Steps to extract blobs from redologs using zmredodump

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Extract blobs from redologs using zmredodump


   KB 23378        Last updated on 2018-08-8  




0.00
(0 votes)

Problem

Extracting blobs from redologs. Possible scenarios where this may be needed:

  • Extract blobs from redologs when we don't have a valid backup to perform the restore.
  • Extract blobs from redologs when full-backup is missing and only incremental backups are available.
  • Also, we can use this procedure when the redolog sequence is broken and we can't use zmredoplay.

Solution

This should only be used when there is no valid backup to perform the restore, as this is just a workaround to recover as much data as possible.

With the help of zmredodump we can extract the blob content in plain text format. The "--show-blob" option will print blobs and related operations (like move, delete, etc):

zmredodump -m <mailbox id> /path/of/redolog/file/redo.log --show-blob

The actual blob is present between the <START OF BLOB> and <END OF BLOB> markers

We then start the process to extract blobs for a user.

Extract a single blob

  • Process blob details from redolog file

In this example we are assuming user has mailbox-id "2".

zmredodump -m 2 /opt/zimbra/redolog/archive/redo-20160223.193045.991-seq63.log --show-blob 
VERIFYING DIRECTORY: /opt/zimbra/redolog/archive
VERIFYING: /opt/zimbra/redolog/archive/redo-20160224.193055.837-seq65.log
HEADER
------
sequence: 65
open:     0
filesize: 43948
serverId: c8e2f007-a1da-4660-ae89-15d3b2a8e200
created:  Wed, 2016/02/24 23:51:39.487 IST (1456338099487)
first op: Wed, 2016/02/24 23:58:01.933 IST (1456338481933)
last op:  Thu, 2016/02/25 01:00:43.108 IST (1456342243108)
version:  1.42
------
[00000200 - 0000083f: 1600 bytes; tstamp: 2016/02/24 23:58:01.933 IST] txn 1456338154.1 [CreateMessage] ver=1.42, tstamp=1456338481933, change=20600, mailbox=1, id=2260, rcpt=admin@hcent7.lab.zimbra.com, rcvDate=1456338481835, shared=false, blobDigest="m3biKcUSkugQxOXnEHVbi341JxT2OyeTnYUTlY6Gcyw=", size=1358, dataLen=1358, folder=2, conv=-1, convFirstMsgId=-1, calItemPartStat=NE, noICal=false, flags=512, tags=[], bodyType=1, path=/opt/zimbra/store/incoming/1456338152510-0.msg
<START OF BLOB>
Return-Path: admin@hcent7.lab.zimbra.com
Received: from hcent7.lab.zimbra.com (LHLO hcent7.lab.zimbra.com)
(10.15.8.19) by hcent7.lab.zimbra.com with LMTP; Wed, 24 Feb 2016 23:57:59
+0530 (IST)
Received: from localhost (localhost [127.0.0.1])
       by hcent7.lab.zimbra.com (Postfix) with ESMTP id 3D37AC5AAA0F
       for <admin@hcent7.lab.zimbra.com>; Wed, 24 Feb 2016 23:52:06 +0530 (IST)
X-Virus-Scanned: amavisd-new at hcent7.lab.zimbra.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-10 required=6.6
       tests=[BAYES_00=-1.9, NO_RELAYS=-0.001]
       autolearn=ham autolearn_force=no
Received: from hcent7.lab.zimbra.com ([127.0.0.1])
       by localhost (hcent7.lab.zimbra.com [127.0.0.1]) (amavisd-new, port 10024)
       with ESMTP id a7Vc0nHRYA7e for <admin@hcent7.lab.zimbra.com>;
       Wed, 24 Feb 2016 23:51:56 +0530 (IST)
Received: by hcent7.lab.zimbra.com (Postfix, from userid 995)
       id E2413C5A120D; Wed, 24 Feb 2016 23:51:55 +0530 (IST)
To: admin@hcent7.lab.zimbra.com
From: admin@hcent7.lab.zimbra.com
Subject: Service mailboxd stopped on hcent7.lab.zimbra.com
Message-Id: <20160224182155.E2413C5A120D@hcent7.lab.zimbra.com>
Date: Wed, 24 Feb 2016 23:51:55 +0530 (IST)

Feb 24 23:51:53 hcent7 zmconfigd[4430]: Service status change: hcent7.lab.zimbra.com mailboxd changed from running to stopped

<END OF BLOB>
[00000840 - 00000871: 50 bytes; tstamp: 2016/02/24 23:58:07.775 IST] txn 1456338154.1 [CommitTxn] ver=1.42, tstamp=1456338487775, mailbox=1, txnType=CreateMessage
[00000872 - 00000ead: 1596 bytes; tstamp: 2016/02/24 23:58:08.561 IST] txn 1456338154.2 [CreateMessage] ver=1.42, tstamp=1456338488561, change=20601, mailbox=1, id=2261, rcpt=admin@hcent7.lab.zimbra.com, rcvDate=1456338488561, shared=false, blobDigest="sIk30SXTvBw8lt+UjjBuVmoQcJJl6agNI+wHzBOJH8I=", size=1354, dataLen=1354, folder=2, conv=-1, convFirstMsgId=-1, calItemPartStat=NE, noICal=false, flags=512, tags=[], bodyType=1, path=/opt/zimbra/store/incoming/1456338152510-2.msg
  • Create a file that only has the content between <START OF BLOB> and <END OF BLOB>. This is our actual blob file.

In our example, we create "/tmp/message1_recover.msg" with the blob content.

Return-Path: admin@hcent7.lab.zimbra.com
Received: from hcent7.lab.zimbra.com (LHLO hcent7.lab.zimbra.com)
(10.15.8.19) by hcent7.lab.zimbra.com with LMTP; Wed, 24 Feb 2016 23:57:59
+0530 (IST)
Received: from localhost (localhost [127.0.0.1])
       by hcent7.lab.zimbra.com (Postfix) with ESMTP id 3D37AC5AAA0F
        for <admin@hcent7.lab.zimbra.com>; Wed, 24 Feb 2016 23:52:06 +0530 (IST)
X-Virus-Scanned: amavisd-new at hcent7.lab.zimbra.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-10 required=6.6
       tests=[BAYES_00=-1.9, NO_RELAYS=-0.001]
       autolearn=ham autolearn_force=no
Received: from hcent7.lab.zimbra.com ([127.0.0.1])
       by localhost (hcent7.lab.zimbra.com [127.0.0.1]) (amavisd-new, port 10024)
       with ESMTP id a7Vc0nHRYA7e for <admin@hcent7.lab.zimbra.com>;
       Wed, 24 Feb 2016 23:51:56 +0530 (IST)
Received: by hcent7.lab.zimbra.com (Postfix, from userid 995)
       id E2413C5A120D; Wed, 24 Feb 2016 23:51:55 +0530 (IST)
To: admin@hcent7.lab.zimbra.com
From: admin@hcent7.lab.zimbra.com
Subject: Service mailboxd stopped on hcent7.lab.zimbra.com
Message-Id: <20160224182155.E2413C5A120D@hcent7.lab.zimbra.com>
Date: Wed, 24 Feb 2016 23:51:55 +0530 (IST)
Feb 24 23:51:53 hcent7 zmconfigd[4430]: Service status change: hcent7.lab.zimbra.com mailboxd changed from running to stopped
  • Use "zmmailbox addMessage" to add blob "/tmp/message1_recover.msg" to a folder in user's mailbox

The following commands add the blob to a folder (called 'Recovery') in the user's mailbox. The folder needs to be created before this:

zmmailbox -z -m USER@DOMAIN.COM createFolder --view message /Recovery   
zmmailbox -z -m USER@DOMAIN.COM addMessage /Recovery /tmp/message1_recover.msg

Check the newly added messages using the zmmailbox command or in the webclient.

Extract Multiple Blobs

The above procedure shows how we can extract single blob from a redolog file. We will now build on this, and show how to extract multiple blobs for a user from single redolog file or multiple redolog files/folder.

  • Create a folder to save all extracted blobs
mkdir /tmp/redodump_blobs
  • Now switch to the created folder and run following commands
cd /tmp/redodump_blobs
zmredodump -m 2 /opt/zimbra/redolog/archive/ --show-blob | sed -n '/<START OF BLOB>/,/<END OF BLOB>/p' | awk -v n=0 '/^<START OF BLOB>/{close("blob"n);n++;next} {print > "blob"n".msg"}' 
perl -pi -e 's/<END OF BLOB>//g' ./blob*.msg

The above commands will extract blobs and create separate files for each blob like the following:

blob1.msg
blob2.msg
blob3.msg
blob4.msg 
.....
.....
blobN.msg 
  • Create a new folder in the user's mailbox and add the extracted blobs in bulk :
zmmailbox -z -m USER@DOMAIN.COM createFolder --view message /Recovery
zmmailbox -z -m USER@DOMAIN.COM addMessage /Recovery /tmp/redodump_blobs/
  • Check the newly added messages using 'the zmmailbox' command or in the webclient.


Submitted by: Heera Singh Koranga
Verified Against: ZCS 8.8, 8.7, 8.6 Date Created: 2017-09-12
Article ID: https://wiki.zimbra.com/index.php?title=Steps_to_extract_blobs_from_redologs_using_zmredodump Date Modified: 2018-08-08



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Jump to: navigation, search