1 ZDB(1M)                      Maintenance Commands                      ZDB(1M)
   2 
   3 NAME
   4      zdb - display zpool debugging and consistency information
   5 
   6 SYNOPSIS
   7      zdb [-AbcdDFGhikLMPsvX] [-e [-V] [-p path ...]] [-I inflight I/Os]
   8          [-o var=value]... [-t txg] [-U cache] [-x dumpdir]
   9          [poolname [object ...]]
  10      zdb [-AdiPv] [-e [-V] [-p path ...]] [-U cache] dataset [object ...]
  11      zdb -C [-A] [-U cache]
  12      zdb -E [-A] word0:word1:...:word15
  13      zdb -l [-Aqu] device
  14      zdb -m [-AFLPX] [-e [-V] [-p path ...]] [-t txg] [-U cache]
  15          poolname [vdev [metaslab ...]]
  16      zdb -O dataset path
  17      zdb -R [-A] [-e [-V] [-p path ...]] [-U cache]
  18          poolname vdev:offset:size[:flags]
  19      zdb -S [-AP] [-e [-V] [-p path ...]] [-U cache] poolname
  20 
  21 DESCRIPTION
  22      The zdb utility displays information about a ZFS pool useful for
  23      debugging and performs some amount of consistency checking.  It is a not
  24      a general purpose tool and options (and facilities) may change.  This is
  25      neither a fsck(1M) nor an fsdb(1M) utility.
  26 
  27      The output of this command in general reflects the on-disk structure of a
  28      ZFS pool, and is inherently unstable.  The precise output of most
  29      invocations is not documented, a knowledge of ZFS internals is assumed.
  30 
  31      If the dataset argument does not contain any "/" or "@" characters, it is
  32      interpreted as a pool name.  The root dataset can be specified as pool/
  33      (pool name followed by a slash).
  34 
  35      When operating on an imported and active pool it is possible, though
  36      unlikely, that zdb may interpret inconsistent pool data and behave
  37      erratically.
  38 
  39 OPTIONS
  40      Display options:
  41 
  42      -b      Display statistics regarding the number, size (logical, physical
  43              and allocated) and deduplication of blocks.
  44 
  45      -c      Verify the checksum of all metadata blocks while printing block
  46              statistics (see -b).
  47 
  48              If specified multiple times, verify the checksums of all blocks.
  49 
  50      -C      Display information about the configuration.  If specified with
  51              no other options, instead display information about the cache
  52              file (/etc/zfs/zpool.cache).  To specify the cache file to
  53              display, see -U.
  54 
  55              If specified multiple times, and a pool name is also specified
  56              display both the cached configuration and the on-disk
  57              configuration.  If specified multiple times with -e also display
  58              the configuration that would be used were the pool to be
  59              imported.
  60 
  61      -d      Display information about datasets.  Specified once, displays
  62              basic dataset information: ID, create transaction, size, and
  63              object count.
  64 
  65              If specified multiple times provides greater and greater
  66              verbosity.
  67 
  68              If object IDs are specified, display information about those
  69              specific objects only.
  70 
  71      -D      Display deduplication statistics, including the deduplication
  72              ratio (dedup), compression ratio (compress), inflation due to the
  73              zfs copies property (copies), and an overall effective ratio
  74              (dedup * compress / copies).
  75 
  76      -DD     Display a histogram of deduplication statistics, showing the
  77              allocated (physically present on disk) and referenced (logically
  78              referenced in the pool) block counts and sizes by reference
  79              count.
  80 
  81      -DDD    Display the statistics independently for each deduplication
  82              table.
  83 
  84      -DDDD   Dump the contents of the deduplication tables describing
  85              duplicate blocks.
  86 
  87      -DDDDD  Also dump the contents of the deduplication tables describing
  88              unique blocks.
  89 
  90      -E word0:word1:...:word15
  91              Decode and display block from an embedded block pointer specified
  92              by the word arguments.
  93 
  94      -h      Display pool history similar to zpool history, but include
  95              internal changes, transaction, and dataset information.
  96 
  97      -i      Display information about intent log (ZIL) entries relating to
  98              each dataset.  If specified multiple times, display counts of
  99              each intent log transaction type.
 100 
 101      -k      Examine the checkpointed state of the pool.  Note, the on disk
 102              format of the pool is not reverted to the checkpointed state.
 103 
 104      -l device
 105              Read the vdev labels from the specified device.  zdb -l will
 106              return 0 if valid label was found, 1 if error occurred, and 2 if
 107              no valid labels were found.
 108 
 109              If the -q option is also specified, don't print the labels.
 110 
 111              If the -u option is also specified, also display the uberblocks
 112              on this device.
 113 
 114      -L      Disable leak detection and the loading of space maps.  By
 115              default, zdb verifies that all non-free blocks are referenced,
 116              which can be very expensive.
 117 
 118      -m      Display the offset, spacemap, and free space of each metaslab.
 119 
 120      -mm     Also display information about the on-disk free space histogram
 121              associated with each metaslab.
 122 
 123      -mmm    Display the maximum contiguous free space, the in-core free space
 124              histogram, and the percentage of free space in each space map.
 125 
 126      -mmmm   Display every spacemap record.
 127 
 128      -M      Display the offset, spacemap, and free space of each metaslab.
 129 
 130      -MM     Also display information about the maximum contiguous free space
 131              and the percentage of free space in each space map.
 132 
 133      -MMM    Display every spacemap record.
 134 
 135      -O dataset path
 136              Look up the specified path inside of the dataset and display its
 137              metadata and indirect blocks.  Specified path must be relative to
 138              the root of dataset.  This option can be combined with -v for
 139              increasing verbosity.
 140 
 141      -R poolname vdev:offset:size[:flags]
 142              Read and display a block from the specified device.  By default
 143              the block is displayed as a hex dump, but see the description of
 144              the r flag, below.
 145 
 146              The block is specified in terms of a colon-separated tuple vdev
 147              (an integer vdev identifier) offset (the offset within the vdev)
 148              size (the size of the block to read) and, optionally, flags (a
 149              set of flags, described below).
 150 
 151              b offset  Print block pointer
 152              d         Decompress the block
 153              e         Byte swap the block
 154              g         Dump gang block header
 155              i         Dump indirect block
 156              r         Dump raw uninterpreted block data
 157 
 158      -s      Report statistics on zdb I/O.  Display operation counts,
 159              bandwidth, and error counts of I/O to the pool from zdb.
 160 
 161      -S      Simulate the effects of deduplication, constructing a DDT and
 162              then display that DDT as with -DD.
 163 
 164      -u      Display the current uberblock.
 165 
 166      Other options:
 167 
 168      -A      Do not abort should any assertion fail.
 169 
 170      -AA     Enable panic recovery, certain errors which would otherwise be
 171              fatal are demoted to warnings.
 172 
 173      -AAA    Do not abort if asserts fail and also enable panic recovery.
 174 
 175      -e [-p path ...]
 176              Operate on an exported pool, not present in /etc/zfs/zpool.cache.
 177              The -p flag specifies the path under which devices are to be
 178              searched.
 179 
 180      -x dumpdir
 181              All blocks accessed will be copied to files in the specified
 182              directory.  The blocks will be placed in sparse files whose name
 183              is the same as that of the file or device read.  zdb can be then
 184              run on the generated files.  Note that the -bbc flags are
 185              sufficient to access (and thus copy) all metadata on the pool.
 186 
 187      -F      Attempt to make an unreadable pool readable by trying
 188              progressively older transactions.
 189 
 190      -G      Dump the contents of the zfs_dbgmsg buffer before exiting zdb.
 191              zfs_dbgmsg is a buffer used by ZFS to dump advanced debug
 192              information.
 193 
 194      -I inflight I/Os
 195              Limit the number of outstanding checksum I/Os to the specified
 196              value.  The default value is 200.  This option affects the
 197              performance of the -c option.
 198 
 199      -o var=value ...
 200              Set the given global libzpool variable to the provided value.
 201              The value must be an unsigned 32-bit integer.  Currently only
 202              little-endian systems are supported to avoid accidentally setting
 203              the high 32 bits of 64-bit variables.
 204 
 205      -P      Print numbers in an unscaled form more amenable to parsing, eg.
 206              1000000 rather than 1M.
 207 
 208      -t transaction
 209              Specify the highest transaction to use when searching for
 210              uberblocks.  See also the -u and -l options for a means to see
 211              the available uberblocks and their associated transaction
 212              numbers.
 213 
 214      -U cachefile
 215              Use a cache file other than /etc/zfs/zpool.cache.
 216 
 217      -v      Enable verbosity.  Specify multiple times for increased
 218              verbosity.
 219 
 220      -V      Attempt verbatim import.  This mimics the behavior of the kernel
 221              when loading a pool from a cachefile.  Only usable with -e.
 222 
 223      -X      Attempt "extreme" transaction rewind, that is attempt the same
 224              recovery as -F but read transactions otherwise deemed too old.
 225 
 226      Specifying a display option more than once enables verbosity for only
 227      that option, with more occurrences enabling more verbosity.
 228 
 229      If no options are specified, all information about the named pool will be
 230      displayed at default verbosity.
 231 
 232 EXAMPLES
 233      Example 1 Display the configuration of imported pool rpool
 234 
 235              # zdb -C rpool
 236 
 237              MOS Configuration:
 238                      version: 28
 239                      name: 'rpool'
 240               ...
 241 
 242      Example 2 Display basic dataset information about rpool
 243 
 244              # zdb -d rpool
 245              Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
 246              Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
 247               ...
 248 
 249      Example 3 Display basic information about object 0 in rpool/export/home
 250 
 251              # zdb -d rpool/export/home 0
 252              Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
 253 
 254                  Object  lvl   iblk   dblk  dsize  lsize   %full  type
 255                       0    7    16K    16K  15.0K    16K   25.00  DMU dnode
 256 
 257      Example 4 Display the predicted effect of enabling deduplication on rpool
 258 
 259              # zdb -S rpool
 260              Simulated DDT histogram:
 261 
 262              bucket              allocated                       referenced
 263              ______   ______________________________   ______________________________
 264              refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
 265              ------   ------   -----   -----   -----   ------   -----   -----   -----
 266                   1     694K   27.1G   15.0G   15.0G     694K   27.1G   15.0G   15.0G
 267                   2    35.0K   1.33G    699M    699M    74.7K   2.79G   1.45G   1.45G
 268               ...
 269              dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00
 270 
 271 SEE ALSO
 272      zfs(1M), zpool(1M)
 273 
 274 illumos                         April 14, 2017                         illumos