ZDB

Section: Maintenance Commands (8)
Updated: April 14, 2017

 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
SEE ALSO

Return to Main Contents

BSD mandoc
Linux  

NAME

zdb - display zpool debugging and consistency information  

SYNOPSIS

[-AbcdDFGhiLMPsvX ] [-e [-V [-p path ... ] ] ] [-I inflight I/[-o var = value ... ] ] [-t txg ] [-U cache ] [-x dumpdir ] [poolname [object ... ] ]
[-AdiPv [-e [-V [-p path ... ] ] ] ] [-U cache ] dataset [object ... ]
-C [-A ] [-U cache ]
-E [-A ] word0 : word1 :...: word15
-l [-Aqu ] device
-m [-AFLPX ] [-e [-V [-p path ... ] ] ] [-t txg ] [-U cache ] poolname [vdev [metaslab ... ] ]
-O dataset path
-R [-A ] [-e [-V [-p path ... ] ] ] [-U cache ] poolname vdev : offset : size [: flags ]
-S [-AP ] [-e [-V [-p path ... ] ] ] [-U cache ] poolname  

DESCRIPTION

The utility displays information about a ZFS pool useful for debugging and performs some amount of consistency checking. It is a not a general purpose tool and options (and facilities) may change. This is neither a fsck(1M) nor an fsdb(1M) utility.

The output of this command in general reflects the on-disk structure of a ZFS pool, and is inherently unstable. The precise output of most invocations is not documented, a knowledge of ZFS internals is assumed.

If the dataset argument does not contain any Qq Sy / or Qq Sy @ characters, it is interpreted as a pool name. The root dataset can be specified as pool / (pool name followed by a slash)

When operating on an imported and active pool it is possible, though unlikely, that zdb may interpret inconsistent pool data and behave erratically.  

OPTIONS

Display options:

-b
Display statistics regarding the number, size (logical, physical and allocated) and deduplication of blocks.
-c
Verify the checksum of all metadata blocks while printing block statistics Po see -b Pc .

If specified multiple times, verify the checksums of all blocks.

-C
Display information about the configuration. If specified with no other options, instead display information about the cache file (/etc/zfs/zpool.cache ) To specify the cache file to display, see -U

If specified multiple times, and a pool name is also specified display both the cached configuration and the on-disk configuration. If specified multiple times with -e also display the configuration that would be used were the pool to be imported.

-d
Display information about datasets. Specified once, displays basic dataset information: ID, create transaction, size, and object count.

If specified multiple times provides greater and greater verbosity.

If object IDs are specified, display information about those specific objects only.

-D
Display deduplication statistics, including the deduplication ratio (dedup ) compression ratio (compress ) inflation due to the zfs copies property (copies ) and an overall effective ratio (dedup * compress / copies )
-DD
Display a histogram of deduplication statistics, showing the allocated (physically present on disk) and referenced (logically referenced in the pool) block counts and sizes by reference count.
-DDD
Display the statistics independently for each deduplication table.
-DDDD
Dump the contents of the deduplication tables describing duplicate blocks.
-DDDDD
Also dump the contents of the deduplication tables describing unique blocks.
-E word0 : word1 :...: word15
Decode and display block from an embedded block pointer specified by the word arguments.
-h
Display pool history similar to zpool history but include internal changes, transaction, and dataset information.
-i
Display information about intent log (ZIL) entries relating to each dataset. If specified multiple times, display counts of each intent log transaction type.
-l device
Read the vdev labels from the specified device. -l will return 0 if valid label was found, 1 if error occurred, and 2 if no valid labels were found. Each unique configuration is displayed only once.
-ll device
In addition display label space usage stats.
-lll device
Display every configuration, unique or not.

If the -q option is also specified, don't print the labels.

If the -u option is also specified, also display the uberblocks on this device. Specify multiple times to increase verbosity.

-L
Disable leak tracing and the loading of space maps. By default, verifies that all non-free blocks are referenced, which can be very expensive.
-m
Display the offset, spacemap, and free space of each metaslab.
-mm
Also display information about the on-disk free space histogram associated with each metaslab.
-mmm
Display the maximum contiguous free space, the in-core free space histogram, and the percentage of free space in each space map.
-mmmm
Display every spacemap record.
-M
Display the offset, spacemap, and free space of each metaslab.
-MM
Also display information about the maximum contiguous free space and the percentage of free space in each space map.
-MMM
Display every spacemap record.
-O dataset path
Look up the specified path inside of the dataset and display its metadata and indirect blocks. Specified path must be relative to the root of dataset This option can be combined with -v for increasing verbosity.
-R poolname vdev : offset : size [: flags ]
Read and display a block from the specified device. By default the block is displayed as a hex dump, but see the description of the r flag, below.

The block is specified in terms of a colon-separated tuple vdev (an integer vdev identifier) offset (the offset within the vdev) size (the size of the block to read) and, optionally, flags (a set of flags, described below)

b offset
Print block pointer
d
Decompress the block. Set environment variable ZBD_NO_ZLE to skip zle when guessing.
e
Byte swap the block
g
Dump gang block header
i
Dump indirect block
r
Dump raw uninterpreted block data

-s
Report statistics on zdb I/O. Display operation counts, bandwidth, and error counts of I/O to the pool from .
-S
Simulate the effects of deduplication, constructing a DDT and then display that DDT as with -DD
-u
Display the current uberblock.

Other options:

-A
Do not abort should any assertion fail.
-AA
Enable panic recovery, certain errors which would otherwise be fatal are demoted to warnings.
-AAA
Do not abort if asserts fail and also enable panic recovery.
-e [-p path ... ]
Operate on an exported pool, not present in /etc/zfs/zpool.cache The -p flag specifies the path under which devices are to be searched.
-x dumpdir
All blocks accessed will be copied to files in the specified directory. The blocks will be placed in sparse files whose name is the same as that of the file or device read. can be then run on the generated files. Note that the -bbc flags are sufficient to access (and thus copy) all metadata on the pool.
-F
Attempt to make an unreadable pool readable by trying progressively older transactions.
-G
Dump the contents of the zfs_dbgmsg buffer before exiting . zfs_dbgmsg is a buffer used by ZFS to dump advanced debug information.
-I inflight I/Limit the number of outstanding checksum I/to the specified value.
The default value is 200. This option affects the performance of the -c option.
-o var = value ...
Set the given global libzpool variable to the provided value. The value must be an unsigned 32-bit integer. Currently only little-endian systems are supported to avoid accidentally setting the high 32 bits of 64-bit variables.
-P
Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather than 1M.
-t transaction
Specify the highest transaction to use when searching for uberblocks. See also the -u and -l options for a means to see the available uberblocks and their associated transaction numbers.
-U cachefile
Use a cache file other than /etc/zfs/zpool.cache
-v
Enable verbosity. Specify multiple times for increased verbosity.
-V
Attempt verbatim import. This mimics the behavior of the kernel when loading a pool from a cachefile. Only usable with -e
-X
Attempt Qq extreme transaction rewind, that is attempt the same recovery as -F but read transactions otherwise deemed too old.

Specifying a display option more than once enables verbosity for only that option, with more occurrences enabling more verbosity.

If no options are specified, all information about the named pool will be displayed at default verbosity.  

EXAMPLES

Example 1
Display the configuration of imported pool rpool
# zdb -C rpool

MOS Configuration:
        version: 28
        name: 'rpool'
 ...
Example 2
Display basic dataset information about rpool
# zdb -d rpool
Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
 ...
Example 3
Display basic information about object 0 in rpool/export/home
# zdb -d rpool/export/home 0
Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects

    Object  lvl   iblk   dblk  dsize  lsize   %full  type
         0    7    16K    16K  15.0K    16K   25.00  DMU dnode
Example 4
Display the predicted effect of enabling deduplication on rpool
# zdb -S rpool
Simulated DDT histogram:

bucket              allocated                       referenced
______   ______________________________   ______________________________
refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
------   ------   -----   -----   -----   ------   -----   -----   -----
     1     694K   27.1G   15.0G   15.0G     694K   27.1G   15.0G   15.0G
     2    35.0K   1.33G    699M    699M    74.7K   2.79G   1.45G   1.45G
 ...
dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00

 

SEE ALSO

zfs(8), zpool(8)