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