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