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