Advanced usage of ZFS Debug command zdb

Source: Internet
Author: User

ZDB command itself can be consulted man zdb or zdb–help provide help, helpless help too concise, but also omitted a lot of very important, useful parameters, just this few days study, on record.

The following assumes that the name of the pool is case2.2:




Zdb–uuu case2.2

Function: Displays the activity Uberblock of the case2.2 and displays its DVA, as shown in the results:


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/29/wKioL1fqt9CCFjfWAAJ53tHSs4o058.png "title=" Picture 0. PNG "width=" "height=" 181 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:181px; "alt=" Wkiol1fqt9ccfjfwaaj53thss4o058.png "/>



ZDB–DDDDD case2.2

Function: Displays a detailed summary of the objects on all file system collections, with too much useful information after export. enough to look at N long.


ZDB–DDDDD CASE2.2/4

Function: Display case2.2 user File System 4th node file summary information, including DVA information, if it is zdb–ddddd case2.2 4, is the meta collection of the 4th node summary information.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/88/2C/wKiom1fqt9KQ7bHWAAWpfQEC1lk935.png "title=" Picture 1. PNG "style=" FLOAT:NONE;WIDTH:600PX;HEIGHT:504PX; "width=" "height=" 504 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1fqt9kq7bhwaawpfqec1lk935.png "/>



#!/bin/bashecho "readzfsobj.sh <poolname> <objectid> <outfile>" Touch $3zdb-ddddd $1/$ |sed-n "/^ *[ 0123456789abcdef]* *l0 */P "|awk ' {print $} ' |while read Linedo #echo" Zy: $line "Zdb-r $ $line: R >>$3done

Role: Use this shell script, with the ZDB command, you can export the specified object, mainly for the study of directory and other non-file collection data. If you know the node number of a directory through the ls-i command, execute

readzfsobj.sh case2.2 4 root.img

The file system root block can be exported to a normal file, and then the binary tool is easier to read the structure of Mzap,fatzap.

Approximate principle: Suppose there is a large directory ID of 13, because execution zdb-ddddd case2.2 13 o'clock, the address index information is listed as shown in the directory, filtered out through the SED command, and then through awk printing the DVA. Finally, the block is exported and entered into the target file by executing the zdb-r command in one line (this example is the processing scheme after removing the compression option, if there is compression, the targeted disposition should be done).

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/88/29/wKioL1fqt3iipaAtAAfNibzLJwE725.png-wh_500x0-wm_3 -wmp_4-s_3269943732.png "title=" image 2.png "alt=" wkiol1fqt3iipaataafnibzljwe725.png-wh_50 "width=" "height=" 571 " Border= "2" hspace= "0" vspace= "0" style= "width:600px;height:571px;"/>




Reference: Description of a section of the ZDB command in http://cuddletech.com/?p=407

    there is 3 arguments that is really the core ones of interest, but fefore we get to them, you Absolutely must understand something unique about  zdb . ZDB is like a magnifying glass with the default magnification you can see the IT tissue, turn up the magnification and you SE e that it had veins, turn it up again and what do intricate the system is, crank it up one more time and you can see B Lood cells themselves. With ZDB, each time we repeat an argument we increase the verbosity and thus dig deeper. for instance,  zdb-d  will list the datasets of a pool, but  zdb-dd  will output The L Ist of objects within the pool. Thus, when you really the zoom in you'll see commands the look really odd like  zdb-ddddddddd . This takes a little practice to get the hang of, so please toy around on a small test pool to get the hang of it.

Now, here is summaries of the 3 primary arguments you'll use and how to things change as your crank up the verbosity:


    • Zdb-b Pool:this would traverse blocks looking for leaks like the default form.


      • -bb:outputs a breakdown of space (block) usage for various ZFS object types.

      • -bbb:same as above, but includes breakdown by Dmu/spa level (L0-L6).

      • -bbbb:same as above, but includes line line per object with details about it, including compression, checksum, DVA, objec T ID, etc.

      • -BBBBB ...: Same as above.


    • Zdb-d dataset:this would output a list of objects within a dataset. More d ' s means more verbosity:


      • -d:output list of datasets, including ID, CR_TXG, size, and number of objects.

      • –dd:output Concise list of objects within the dataset, with Object ID, lsize, asize, type, etc.

      • -ddd:same as DD.

      • -dddd:outputs List of datasets and objects in detail, including objects path (filename), a/c/r/mtime, mode, etc.

      • -ddddd:same as previous, but includes indirect block addresses (Dvas) as well.

      • -dddddd ....: Same as above.


    • Zdb-r Pool:vdev_specifier:offset:size[:flags]: Given a DVA, outputs object contents in hex display format. If given THE:R flag it would output in raw binary format. This can is used for manual recovery of files.

This article is from the "Zhang Yu (Data Recovery)" blog, please be sure to keep this source http://zhangyu.blog.51cto.com/197148/1857185

Advanced usage of ZFS Debug command zdb

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.