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