1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" Copyright 2012, Richard Lowe. 12.\" Copyright (c) 2012, 2019 by Delphix. All rights reserved. 13.\" Copyright 2017 Nexenta Systems, Inc. 14.\" Copyright (c) 2017 Lawrence Livermore National Security, LLC. 15.\" Copyright (c) 2017 Intel Corporation. 16.\" 17.Dd October 7, 2020 18.Dt ZDB 8 19.Os 20. 21.Sh NAME 22.Nm zdb 23.Nd display ZFS storage pool debugging and consistency information 24.Sh SYNOPSIS 25.Nm 26.Op Fl AbcdDFGhikLMNPsvXYy 27.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns … 28.Op Fl I Ar inflight-I/O-ops 29.Oo Fl o Ar var Ns = Ns Ar value Oc Ns … 30.Op Fl t Ar txg 31.Op Fl U Ar cache 32.Op Fl x Ar dumpdir 33.Op Ar poolname Ns Op / Ns Ar dataset Ns | Ns Ar objset-ID 34.Op Ar object Ns | Ns Ar range Ns … 35.Nm 36.Op Fl AdiPv 37.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns … 38.Op Fl U Ar cache 39.Ar poolname Ns Op Ar / Ns Ar dataset Ns | Ns Ar objset-ID 40.Op Ar object Ns | Ns Ar range Ns … 41.Nm 42.Fl C 43.Op Fl A 44.Op Fl U Ar cache 45.Nm 46.Fl E 47.Op Fl A 48.Ar word0 : Ns Ar word1 Ns :…: Ns Ar word15 49.Nm 50.Fl l 51.Op Fl Aqu 52.Ar device 53.Nm 54.Fl m 55.Op Fl AFLPXY 56.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns … 57.Op Fl t Ar txg 58.Op Fl U Ar cache 59.Ar poolname Op Ar vdev Oo Ar metaslab Oc Ns … 60.Nm 61.Fl O 62.Ar dataset path 63.Nm 64.Fl r 65.Ar dataset path destination 66.Nm 67.Fl R 68.Op Fl A 69.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns … 70.Op Fl U Ar cache 71.Ar poolname vdev : Ns Ar offset : Ns Oo Ar lsize Ns / Oc Ns Ar psize Ns Op : Ns Ar flags 72.Nm 73.Fl S 74.Op Fl AP 75.Op Fl e Oo Fl V Oc Oo Fl p Ar path Oc Ns … 76.Op Fl U Ar cache 77.Ar poolname 78. 79.Sh DESCRIPTION 80The 81.Nm 82utility displays information about a ZFS pool useful for debugging and performs 83some amount of consistency checking. 84It is a not a general purpose tool and options 85.Pq and facilities 86may change. 87It is not a 88.Xr fsck 8 89utility. 90.Pp 91The output of this command in general reflects the on-disk structure of a ZFS 92pool, and is inherently unstable. 93The precise output of most invocations is not documented, a knowledge of ZFS 94internals is assumed. 95.Pp 96If the 97.Ar dataset 98argument does not contain any 99.Qq Sy / 100or 101.Qq Sy @ 102characters, it is interpreted as a pool name. 103The root dataset can be specified as 104.Qq Ar pool Ns / . 105.Pp 106When operating on an imported and active pool it is possible, though unlikely, 107that zdb may interpret inconsistent pool data and behave erratically. 108. 109.Sh OPTIONS 110Display options: 111.Bl -tag -width Ds 112.It Fl b , -block-stats 113Display statistics regarding the number, size 114.Pq logical, physical and allocated 115and deduplication of blocks. 116.It Fl c , -checksum 117Verify the checksum of all metadata blocks while printing block statistics 118.Po see 119.Fl b 120.Pc . 121.Pp 122If specified multiple times, verify the checksums of all blocks. 123.It Fl C , -config 124Display information about the configuration. 125If specified with no other options, instead display information about the cache 126file 127.Pq Pa /etc/zfs/zpool.cache . 128To specify the cache file to display, see 129.Fl U . 130.Pp 131If specified multiple times, and a pool name is also specified display both the 132cached configuration and the on-disk configuration. 133If specified multiple times with 134.Fl e 135also display the configuration that would be used were the pool to be imported. 136.It Fl d , -datasets 137Display information about datasets. 138Specified once, displays basic dataset information: ID, create transaction, 139size, and object count. 140See 141.Fl N 142for determining if 143.Ar poolname Ns Op / Ns Ar dataset Ns | Ns Ar objset-ID 144is to use the specified 145.Ar dataset Ns | Ns Ar objset-ID 146as a string (dataset name) or a number (objset ID) when 147datasets have numeric names. 148.Pp 149If specified multiple times provides greater and greater verbosity. 150.Pp 151If object IDs or object ID ranges are specified, display information about 152those specific objects or ranges only. 153.Pp 154An object ID range is specified in terms of a colon-separated tuple of 155the form 156.Ao start Ac : Ns Ao end Ac Ns Op : Ns Ao flags Ac . 157The fields 158.Ar start 159and 160.Ar end 161are integer object identifiers that denote the upper and lower bounds 162of the range. 163An 164.Ar end 165value of -1 specifies a range with no upper bound. 166The 167.Ar flags 168field optionally specifies a set of flags, described below, that control 169which object types are dumped. 170By default, all object types are dumped. 171A minus sign 172.Pq - 173negates the effect of the flag that follows it and has no effect unless 174preceded by the 175.Ar A 176flag. 177For example, the range 0:-1:A-d will dump all object types except for directories. 178.Pp 179.Bl -tag -compact -width Ds 180.It Sy A 181Dump all objects (this is the default) 182.It Sy d 183Dump ZFS directory objects 184.It Sy f 185Dump ZFS plain file objects 186.It Sy m 187Dump SPA space map objects 188.It Sy z 189Dump ZAP objects 190.It Sy - 191Negate the effect of next flag 192.El 193.It Fl D , -dedup-stats 194Display deduplication statistics, including the deduplication ratio 195.Pq Sy dedup , 196compression ratio 197.Pq Sy compress , 198inflation due to the zfs copies property 199.Pq Sy copies , 200and an overall effective ratio 201.Pq Sy dedup No \(mu Sy compress No / Sy copies . 202.It Fl DD 203Display a histogram of deduplication statistics, showing the allocated 204.Pq physically present on disk 205and referenced 206.Pq logically referenced in the pool 207block counts and sizes by reference count. 208.It Fl DDD 209Display the statistics independently for each deduplication table. 210.It Fl DDDD 211Dump the contents of the deduplication tables describing duplicate blocks. 212.It Fl DDDDD 213Also dump the contents of the deduplication tables describing unique blocks. 214.It Fl E , -embedded-block-pointer Ns = Ns Ar word0 : Ns Ar word1 Ns :…: Ns Ar word15 215Decode and display block from an embedded block pointer specified by the 216.Ar word 217arguments. 218.It Fl h , -history 219Display pool history similar to 220.Nm zpool Cm history , 221but include internal changes, transaction, and dataset information. 222.It Fl i , -intent-logs 223Display information about intent log 224.Pq ZIL 225entries relating to each dataset. 226If specified multiple times, display counts of each intent log transaction type. 227.It Fl k , -checkpointed-state 228Examine the checkpointed state of the pool. 229Note, the on disk format of the pool is not reverted to the checkpointed state. 230.It Fl l , -label Ns = Ns Ar device 231Read the vdev labels and L2ARC header from the specified device. 232.Nm Fl l 233will return 0 if valid label was found, 1 if error occurred, and 2 if no valid 234labels were found. 235The presence of L2ARC header is indicated by a specific 236sequence (L2ARC_DEV_HDR_MAGIC). 237If there is an accounting error in the size or the number of L2ARC log blocks 238.Nm Fl l 239will return 1. 240Each unique configuration is displayed only once. 241.It Fl ll Ar device 242In addition display label space usage stats. 243If a valid L2ARC header was found 244also display the properties of log blocks used for restoring L2ARC contents 245(persistent L2ARC). 246.It Fl lll Ar device 247Display every configuration, unique or not. 248If a valid L2ARC header was found 249also display the properties of log entries in log blocks used for restoring 250L2ARC contents (persistent L2ARC). 251.Pp 252If the 253.Fl q 254option is also specified, don't print the labels or the L2ARC header. 255.Pp 256If the 257.Fl u 258option is also specified, also display the uberblocks on this device. 259Specify multiple times to increase verbosity. 260.It Fl L , -disable-leak-tracking 261Disable leak detection and the loading of space maps. 262By default, 263.Nm 264verifies that all non-free blocks are referenced, which can be very expensive. 265.It Fl m , -metaslabs 266Display the offset, spacemap, free space of each metaslab, all the log 267spacemaps and their obsolete entry statistics. 268.It Fl mm 269Also display information about the on-disk free space histogram associated with 270each metaslab. 271.It Fl mmm 272Display the maximum contiguous free space, the in-core free space histogram, and 273the percentage of free space in each space map. 274.It Fl mmmm 275Display every spacemap record. 276.It Fl M , -metaslab-groups 277Display all "normal" vdev metaslab group information - per-vdev metaslab count, fragmentation, 278and free space histogram, as well as overall pool fragmentation and histogram. 279.It Fl MM 280"Special" vdevs are added to -M's normal output. 281.It Fl O , -object-lookups Ns = Ns Ar dataset path 282Also display information about the maximum contiguous free space and the 283percentage of free space in each space map. 284.It Fl MMM 285Display every spacemap record. 286.It Fl N 287Same as 288.Fl d 289but force zdb to interpret the 290.Op Ar dataset Ns | Ns Ar objset-ID 291in 292.Op Ar poolname Ns Op / Ns Ar dataset Ns | Ns Ar objset-ID 293as a numeric objset ID. 294.It Fl O Ar dataset path 295Look up the specified 296.Ar path 297inside of the 298.Ar dataset 299and display its metadata and indirect blocks. 300Specified 301.Ar path 302must be relative to the root of 303.Ar dataset . 304This option can be combined with 305.Fl v 306for increasing verbosity. 307.It Fl r , -copy-object Ns = Ns Ar dataset path destination 308Copy the specified 309.Ar path 310inside of the 311.Ar dataset 312to the specified destination. 313Specified 314.Ar path 315must be relative to the root of 316.Ar dataset . 317This option can be combined with 318.Fl v 319for increasing verbosity. 320.It Xo 321.Fl R , -read-block Ns = Ns Ar poolname vdev : Ns Ar offset : Ns Oo Ar lsize Ns / Oc Ns Ar psize Ns Op : Ns Ar flags 322.Xc 323Read and display a block from the specified device. 324By default the block is displayed as a hex dump, but see the description of the 325.Sy r 326flag, below. 327.Pp 328The block is specified in terms of a colon-separated tuple 329.Ar vdev 330.Pq an integer vdev identifier 331.Ar offset 332.Pq the offset within the vdev 333.Ar size 334.Pq the physical size, or logical size / physical size 335of the block to read and, optionally, 336.Ar flags 337.Pq a set of flags, described below . 338.Pp 339.Bl -tag -compact -width "b offset" 340.It Sy b Ar offset 341Print block pointer at hex offset 342.It Sy c 343Calculate and display checksums 344.It Sy d 345Decompress the block. 346Set environment variable 347.Nm ZDB_NO_ZLE 348to skip zle when guessing. 349.It Sy e 350Byte swap the block 351.It Sy g 352Dump gang block header 353.It Sy i 354Dump indirect block 355.It Sy r 356Dump raw uninterpreted block data 357.It Sy v 358Verbose output for guessing compression algorithm 359.El 360.It Fl s , -io-stats 361Report statistics on 362.Nm zdb 363I/O. 364Display operation counts, bandwidth, and error counts of I/O to the pool from 365.Nm . 366.It Fl S , -simulate-dedup 367Simulate the effects of deduplication, constructing a DDT and then display 368that DDT as with 369.Fl DD . 370.It Fl u , -uberblock 371Display the current uberblock. 372.El 373.Pp 374Other options: 375.Bl -tag -width Ds 376.It Fl A , -ignore-assertions 377Do not abort should any assertion fail. 378.It Fl AA 379Enable panic recovery, certain errors which would otherwise be fatal are 380demoted to warnings. 381.It Fl AAA 382Do not abort if asserts fail and also enable panic recovery. 383.It Fl e , -exported Ns = Ns Oo Fl p Ar path Oc Ns … 384Operate on an exported pool, not present in 385.Pa /etc/zfs/zpool.cache . 386The 387.Fl p 388flag specifies the path under which devices are to be searched. 389.It Fl x , -dump-blocks Ns = Ns Ar dumpdir 390All blocks accessed will be copied to files in the specified directory. 391The blocks will be placed in sparse files whose name is the same as 392that of the file or device read. 393.Nm 394can be then run on the generated files. 395Note that the 396.Fl bbc 397flags are sufficient to access 398.Pq and thus copy 399all metadata on the pool. 400.It Fl F , -automatic-rewind 401Attempt to make an unreadable pool readable by trying progressively older 402transactions. 403.It Fl G , -dump-debug-msg 404Dump the contents of the zfs_dbgmsg buffer before exiting 405.Nm . 406zfs_dbgmsg is a buffer used by ZFS to dump advanced debug information. 407.It Fl I , -inflight Ns = Ns Ar inflight-I/O-ops 408Limit the number of outstanding checksum I/O operations to the specified value. 409The default value is 200. 410This option affects the performance of the 411.Fl c 412option. 413.It Fl o , -option Ns = Ns Ar var Ns = Ns Ar value Ns … 414Set the given global libzpool variable to the provided value. 415The value must be an unsigned 32-bit integer. 416Currently only little-endian systems are supported to avoid accidentally setting 417the high 32 bits of 64-bit variables. 418.It Fl P , -parseable 419Print numbers in an unscaled form more amenable to parsing, e.g.\& 420.Sy 1000000 421rather than 422.Sy 1M . 423.It Fl t , -txg Ns = Ns Ar transaction 424Specify the highest transaction to use when searching for uberblocks. 425See also the 426.Fl u 427and 428.Fl l 429options for a means to see the available uberblocks and their associated 430transaction numbers. 431.It Fl U , -cachefile Ns = Ns Ar cachefile 432Use a cache file other than 433.Pa /etc/zfs/zpool.cache . 434.It Fl v , -verbose 435Enable verbosity. 436Specify multiple times for increased verbosity. 437.It Fl V , -verbatim 438Attempt verbatim import. 439This mimics the behavior of the kernel when loading a pool from a cachefile. 440Only usable with 441.Fl e . 442.It Fl X , -extreme-rewind 443Attempt 444.Qq extreme 445transaction rewind, that is attempt the same recovery as 446.Fl F 447but read transactions otherwise deemed too old. 448.It Fl Y , -all-reconstruction 449Attempt all possible combinations when reconstructing indirect split blocks. 450This flag disables the individual I/O deadman timer in order to allow as 451much time as required for the attempted reconstruction. 452.It Fl y , -livelist 453Perform validation for livelists that are being deleted. 454Scans through the livelist and metaslabs, checking for duplicate entries 455and compares the two, checking for potential double frees. 456If it encounters issues, warnings will be printed, but the command will not 457necessarily fail. 458.El 459.Pp 460Specifying a display option more than once enables verbosity for only that 461option, with more occurrences enabling more verbosity. 462.Pp 463If no options are specified, all information about the named pool will be 464displayed at default verbosity. 465. 466.Sh EXAMPLES 467.Ss Example 1 : No Display the configuration of imported pool Ar rpool 468.Bd -literal 469.No # Nm zdb Fl C Ar rpool 470MOS Configuration: 471 version: 28 472 name: 'rpool' 473 … 474.Ed 475. 476.Ss Example 2 : No Display basic dataset information about Ar rpool 477.Bd -literal 478.No # Nm zdb Fl d Ar rpool 479Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects 480Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects 481 … 482.Ed 483. 484.Ss Example 3 : No Display basic information about object 0 in Ar rpool/export/home 485.Bd -literal 486.No # Nm zdb Fl d Ar rpool/export/home 0 487Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects 488 489 Object lvl iblk dblk dsize lsize %full type 490 0 7 16K 16K 15.0K 16K 25.00 DMU dnode 491.Ed 492. 493.Ss Example 4 : No Display the predicted effect of enabling deduplication on Ar rpool 494.Bd -literal 495.No # Nm zdb Fl S Ar rpool 496Simulated DDT histogram: 497 498bucket allocated referenced 499______ ______________________________ ______________________________ 500refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE 501------ ------ ----- ----- ----- ------ ----- ----- ----- 502 1 694K 27.1G 15.0G 15.0G 694K 27.1G 15.0G 15.0G 503 2 35.0K 1.33G 699M 699M 74.7K 2.79G 1.45G 1.45G 504 … 505dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00 506.Ed 507. 508.Sh SEE ALSO 509.Xr zfs 8 , 510.Xr zpool 8 511