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