ZDB(8)
zdb(8) โ display ZFS storage pool debugging and consistency information ๐
okay bestie, buckle UP, because we're about to read the entire on-disk soul of your ZFS pool together and it's giving forensics. ๐ต๏ธโ๏ธโจ
โจ NAME โจ
zdb โ display ZFS storage pool debugging and consistency information ๐ซถ
๐ธ SYNOPSIS ๐ธ
zdb [-AbcdDFGhikLMNPsTvXYy] [-e [-V] [-p path]โฆ] [-I inflight-I/O-ops]
[-o var=value]โฆ [-t txg] [-U cache] [-x dumpdir] [-K key]
[poolname[/dataset|objset-ID]] [object|rangeโฆ]
zdb [-AdiPv] [-e [-V] [-p path]โฆ] [-U cache] [-K key]
poolname[/dataset|objset-ID] [object|rangeโฆ]
zdb -B [-e [-V] [-p path]โฆ] [-U cache] [-K key] poolname/objset-ID
[backup-flags]
zdb -C [-A] [-U cache] [poolname]
zdb -E [-A] word0:word1:โฆ:word15
zdb -l [-Aqu] device
zdb -m [-AFLPXY] [-e [-V] [-p path]โฆ] [-t txg] [-U cache] poolname [vdev
[metaslab]โฆ]
zdb --allocated-map [-mAFLPXY] [-e [-V] [-p path]โฆ] [-t txg] [-U cache]
poolname [vdev [metaslab]โฆ]
zdb -O [-K key] dataset path
zdb -r [-K key] dataset path destination
zdb -r -O [-K key] dataset object-id destination
zdb -R [-A] [-e [-V] [-p path]โฆ] [-U cache] poolname
vdev:offset:[lsize/]psize[:flags]
zdb -S [-AP] [-e [-V] [-p path]โฆ] [-U cache] poolname
๐ DESCRIPTION ๐
okay so the tea is: zdb shows you info about a ZFS pool that's super useful for debugging, and it also does a lil bit of consistency checking while it's at it. โจ But listen โ this is not a general purpose tool, and the options (and the facilities) can literally change on you. It is not a fsck(8) utility. periodt. ๐
The output of this command, generally speaking, reflects the on-disk structure of a ZFS pool, and it is inherently unstable. The precise output of most invocations is not documented, and a knowledge of ZFS internals is assumed. iykyk. ๐ง
If the dataset argument does not contain any / or @ characters, it gets interpreted as a pool name. The root dataset can be specified as "pool/". cute, right? ๐
zdb is an "offline" tool โ it accesses the block devices underneath the pools directly from userspace and does not care if the pool is imported or datasets are mounted (or even if the system understands ZFS at all ๐ญ). When operating on an imported and active pool it is possible, though unlikely, that zdb may interpret inconsistent pool data and behave erratically. so like, vibe check your expectations first. ๐
fr fr: it is not a fsck(8) utility, and the output format is unstable. do not build your whole personality around parsing it.
๐ OPTIONS ๐
๐ Display options ๐
--allocated-mapโ Prints out a list of all the allocated regions in the pool. Primarily intended for use with thezhack metaslab leaksubcommand. ๐-b,--block-statsโ Display statistics regarding the number, size (logical, physical and allocated) and deduplication of blocks. numbers go brrr. ๐--bin=(lsize|psize|asize)โ When used with-bb, sort blocks into all three bins according to the given size (instead of binning a block for each size separately).
For instance, with --bin=lsize, a block with lsize of 16K and psize of 4K will be added to the 16K bin in all three columns. slay, that's the whole bit. โจ
--class=(normal|special|dedup|other)[,โฆ]โ When used with-bb, only consider blocks from these allocation classes. pick your faves. ๐-B,--backupโ Generate a backup stream, similar tozfs send, but for the numeric objset ID, and without opening the dataset. This can be useful in recovery scenarios if dataset metadata has become corrupted but the dataset itself is readable. The optionalflagsargument is a string of one or more of the letterse,L,c, andw, which correspond to the same flags inzfs-send(8). ๐ซถ-c,--checksumโ Verify the checksum of all metadata blocks while printing block statistics (see-b).
If specified multiple times, verify the checksums of all blocks. ๐
-C,--configโ Display information about the configuration. If specified with no other options, instead display information about the cache file (/etc/zfs/zpool.cache). To specify the cache file to display, see-U.
If specified multiple times, and a pool name is also specified, display both the cached configuration and the on-disk configuration. If specified multiple times with -e also display the configuration that would be used were the pool to be imported. so many configs, so little time. ๐ธ
-d,--datasetsโ Display information about datasets. Specified once, displays basic dataset information: ID, create transaction, size, and object count. See-Nfor determining ifpoolname[/dataset|objset-ID]is to use the specifieddataset|objset-IDas a string (dataset name) or a number (objset ID) when datasets have numeric names.
If specified multiple times provides greater and greater verbosity. ๐ฅ
If object IDs or object ID ranges are specified, display information about those specific objects or ranges only.
An object ID range is specified in terms of a colon-separated tuple of the form โจstartโฉ:โจendโฉ[:โจflagsโฉ]. The fields start and end are integer object identifiers that denote the upper and lower bounds of the range. An end value of -1 specifies a range with no upper bound. The flags field optionally specifies a set of flags, described below, that control which object types are dumped. By default, all object types are dumped. A minus sign (-) negates the effect of the flag that follows it and has no effect unless preceded by the A flag. For example, the range 0:-1:A-d will dump all object types except for directories. ๐ฆ
Aโ Dump all objects (this is the default)dโ Dump ZFS directory objectsfโ Dump ZFS plain file objectsmโ Dump SPA space map objectszโ Dump ZAP objects-โ Negate the effect of next flag
-D,--dedup-statsโ Display deduplication statistics, including the deduplication ratio (dedup), compression ratio (compress), inflation due to thezfs copiesproperty (copies), and an overall effective ratio (dedup ร compress / copies). math ate, honestly. ๐งฎ-DDโ Display a histogram of deduplication statistics, showing the allocated (physically present on disk) and referenced (logically referenced in the pool) block counts and sizes by reference count. ๐-DDDโ Display the statistics independently for each deduplication table. ๐-DDDDโ Dump the contents of the deduplication tables describing duplicate blocks. ๐ญ-DDDDDโ Also dump the contents of the deduplication tables describing unique blocks. not me adding one more D like it's nothing ๐-E,--embedded-block-pointer=word0:word1:โฆ:word15โ Decode and display block from an embedded block pointer specified by thewordarguments. ๐-h,--historyโ Display pool history similar tozpool history, but include internal changes, transaction, and dataset information. the receipts, but internal. ๐งพ-i,--intent-logsโ Display information about intent log (ZIL) entries relating to each dataset. If specified multiple times, display counts of each intent log transaction type. ๐-k,--checkpointed-stateโ Examine the checkpointed state of the pool. Note, the on disk format of the pool is not reverted to the checkpointed state. โ ๏ธ look only, no touch.-l,--label=deviceโ Read the vdev labels and L2ARC header from the specified device.zdb -lwill return0if valid label was found,1if error occurred, and2if no valid labels were found. The presence of L2ARC header is indicated by a specific sequence (L2ARC_DEV_HDR_MAGIC). If there is an accounting error in the size or the number of L2ARC log blockszdb -lwill return1. Each unique configuration is displayed only once. โจ-ll deviceโ In addition display label space usage stats. If a valid L2ARC header was found also display the properties of log blocks used for restoring L2ARC contents (persistent L2ARC). ๐-lll deviceโ Display every configuration, unique or not. If a valid L2ARC header was found also display the properties of log entries in log blocks used for restoring L2ARC contents (persistent L2ARC). ๐
If the -q option is also specified, don't print the labels or the L2ARC header.
If the -u option is also specified, also display the uberblocks on this device. Specify multiple times to increase verbosity. ๐ฅ
-L,--disable-leak-trackingโ Disable leak detection and the loading of space maps. By default,zdbverifies that all non-free blocks are referenced, which can be very expensive. ๐ฎ๐จ your wallet-of-time will thank you.-m,--metaslabsโ Display the offset, spacemap, free space of each metaslab, all the log spacemaps and their obsolete entry statistics. ๐-mmโ Also display information about the on-disk free space histogram associated with each metaslab. ๐-mmmโ Display the maximum contiguous free space, the in-core free space histogram, and the percentage of free space in each space map. ๐-mmmmโ Display every spacemap record. literally every single one. ๐-M,--metaslab-groupsโ Display all"normal"vdev metaslab group information โ per-vdev metaslab count, fragmentation, and free space histogram, as well as overall pool fragmentation and histogram. ๐ซถ-MMโ"Special"vdevs are added to-M's normal output. Also display information about the maximum contiguous free space and the percentage of free space in each space map. โญ-MMMโ Display every spacemap record. again. every. one. ๐ญ-Nโ Same as-dbut forcezdbto interpret the[dataset|objset-ID]in[poolname[/dataset|objset-ID]]as a numeric objset ID. no guessing games. ๐ฏ-O,--object-lookups=dataset pathโ Look up the specifiedpathinside of thedatasetand display its metadata and indirect blocks. Specifiedpathmust be relative to the root ofdataset. This option can be combined with-vfor increasing verbosity. ๐-r,--copy-object=dataset path destinationโ Copy the specifiedpathinside of thedatasetto the specifieddestination. Specifiedpathmust be relative to the root ofdataset. When used with-O, thepathargument is interpreted as an object identifier, not a path. This option can be combined with-vfor increasing verbosity. copy that, bestie. ๐-R,--read-block=poolname vdev:offset:[lsize/]psize[:flags]โ Read and display a block from the specified device. By default the block is displayed as a hex dump, but see the description of therflag, below. ๐ง
โฆand that's only part 1, bestie โ more is coming, don't go anywhere ๐
The block is specified in terms of a colon-separated tuple: vdev (an integer vdev identifier), offset (the offset within the vdev), size (the physical size, or logical size / physical size) of the block to read and, optionally, flags (a set of flags, described below). Bestie it's literally just vdev:offset:size[:flags] and you're cooking ๐
b offsetโ Print block pointer at hexoffset๐ฏcโ Calculate and display checksums โdโ Decompress the block. Set the environment variableZDB_NO_ZLEto skip zle when guessing ๐ซงeโ Byte swap the block ๐gโ Dump gang block header ๐ฏiโ Dump indirect block ๐ชrโ Dump raw uninterpreted block data ๐vโ Verbose output for guessing compression algorithm ๐ฃ๏ธ
-s,--io-statsโ Report statistics on zdb I/O. It displays operation counts, bandwidth, and error counts of I/O to the pool from zdb ๐-S,--simulate-dedupโ Simulate the effects of deduplication, constructing a DDT and then displaying that DDT just like-DDdoes ๐งช-T,--brt-statsโ Display block reference table (BRT) statistics, including the size of unique blocks cloned, the space saving as a result of cloning, and the saving ratio ๐-TTโ Display the per-vdev BRT statistics, including total references ๐-TTTโ Display histograms of per-vdev BRT refcounts ๐-TTTTโ Dump the contents of the block reference tables ๐๏ธ-u,--uberblockโ Display the current uberblock โจ
๐ธ Other options ๐ธ
-A,--ignore-assertionsโ Do not abort should any assertion fail ๐-AAโ Enable panic recovery; certain errors which would otherwise be fatal are demoted to warnings ๐ฉน-AAAโ Do not abort if asserts fail and also enable panic recovery ๐-e,--exported=[-p path]โฆโ Operate on an exported pool, not present in/etc/zfs/zpool.cache. The-pflag specifies the path under which devices are to be searched ๐-x,--dump-blocks=dumpdirโ All blocks accessed will be copied to files in the specified directory. The blocks will be placed in sparse files whose name is the same as that of the file or device read. zdb can then be run on the generated files. Note that the-bbcflags are sufficient to access (and thus copy) all metadata on the pool ๐พ-F,--automatic-rewindโ Attempt to make an unreadable pool readable by trying progressively older transactions โช-G,--dump-debug-msgโ Dump the contents of thezfs_dbgmsgbuffer before exiting zdb.zfs_dbgmsgis a buffer used by ZFS to dump advanced debug information ๐-I,--inflight=inflight-I/O-opsโ Limit the number of outstanding checksum I/O operations to the specified value. The default value is200. This option affects the performance of the-coption ๐ฆ-K,--key=keyโ Decryption key needed to access an encrypted dataset. This will cause zdb to attempt to unlock the dataset using the encryption root, key format and other encryption parameters on the given dataset. zdb can still inspect pool and dataset structures on encrypted datasets without unlocking them, but will not be able to access file names and attributes and object contents ๐
WARNING โ ๏ธ โ The raw decryption key and any decrypted data will be in user memory while zdb is running. Other user programs may be able to extract it by inspecting zdb as it runs. Exercise extreme caution when using this option in shared or uncontrolled environments. Not to be dramatic but this is giving "don't do this on a shared box" energy fr fr ๐
-o,--option=var=valueโฆโ Set the given tunable to the provided value ๐๏ธ-o,--option=varโฆโ Show the value of the given tunable ๐-o,--option=showโ Show all tunables and their values ๐-o,--option=info=valueโฆโ Show info about a tunable, including their name, type and description ๐-o,--option=infoโ Show info about all tunables ๐-P,--parseableโ Print numbers in an unscaled form more amenable to parsing, e.g.1000000rather than1M๐ข-t,--txg=transactionโ Specify the highest transaction to use when searching for uberblocks. See also the-uand-loptions for a means to see the available uberblocks and their associated transaction numbers ๐-U,--cachefile=cachefileโ Use a cache file other than/etc/zfs/zpool.cache๐๏ธ-v,--verboseโ Enable verbosity. Specify multiple times for increased verbosity ๐ฃ๏ธ๐ฃ๏ธ๐ฃ๏ธ-V,--verbatimโ Attempt verbatim import. This mimics the behavior of the kernel when loading a pool from a cachefile. Only usable with-e๐งฌ-X,--extreme-rewindโ Attempt "extreme" transaction rewind, that is attempt the same recovery as-Fbut read transactions otherwise deemed too old ๐ฆ-Y,--all-reconstructionโ Attempt all possible combinations when reconstructing indirect split blocks. This flag disables the individual I/O deadman timer in order to allow as much time as required for the attempted reconstruction โณ-y,--livelistโ Perform validation for livelists that are being deleted. Scans through the livelist and metaslabs, checking for duplicate entries and compares the two, checking for potential double frees. If it encounters issues, warnings will be printed, but the command will not necessarily fail ๐งน
Specifying a display option more than once enables verbosity for only that option, with more occurrences enabling more verbosity ๐
If no options are specified, all information about the named pool will be displayed at default verbosity ๐
๐ EXIT STATUS ๐
The zdb utility exits 0 on success, 1 if a fatal error occurs, 2 if invalid command line options were specified, or 3 if on-disk corruption was detected, but was not fatal. Know your numbers bestie, they're the whole plot ๐ฌ
๐ EXAMPLES ๐
๐ Example 1: Display the configuration of imported pool rpool
# zdb -C rpool
MOS Configuration:
version: 28
name: 'rpool'
โฆ
๐ Example 2: Display basic dataset information about rpool
# zdb -d rpool
Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
โฆ
๐ Example 3: Display basic information about object 0 in rpool/export/home
# zdb -d rpool/export/home 0
Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
Object lvl iblk dblk dsize lsize %full type
0 7 16K 16K 15.0K 16K 25.00 DMU dnode
๐ Example 4: Display the predicted effect of enabling deduplication on rpool
# zdb -S rpool
Simulated DDT histogram:
bucket allocated referenced
______ ______________________________ ______________________________
refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
------ ------ ----- ----- ----- ------ ----- ----- -----
1 694K 27.1G 15.0G 15.0G 694K 27.1G 15.0G 15.0G
2 35.0K 1.33G 699M 699M 74.7K 2.79G 1.45G 1.45G
โฆ
dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00
๐ SEE ALSO ๐
zfs(8), zpool(8) โ go read the besties next, they're iconic ๐ซถ
And that's the whole page, bestie!! This one came to you from OpenZFS, dated August 12, 2025 โ ZDB(8) in the house ๐ No cap, you now know zdb better than most people who've been running it for years. Go forth and inspect some blocks โจ๐
๐ฆ where this page comes from
- alpine 3.23: zfs-doc 2.4.4-r0 ยท CDDL-1.0
- alpine 3.24: zfs-doc 2.4.4-r0 ยท CDDL-1.0
- nixos 26.05: zfs-user 2.4.4
- nixpkgs unstable: zfs-user 2.4.4
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5 ยท CDDL-1.0
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5.1 ยท CDDL-1.0
- ubuntu stonking: zfsutils-linux 2.4.4-1ubuntu4 ยท CDDL-1.0
- ๐ the page's license: CDDL-1.0
- Copyright 2012, Richard Lowe
- Copyright (c) 2012, 2019 by Delphix. All rights reserved
- Copyright 2017 Nexenta Systems, Inc
- Copyright (c) 2017 Lawrence Livermore National Security, LLC
- Copyright (c) 2017 Intel Corporation
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms