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