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