Illumos #3306, #3321
[zfs.git] / man / man8 / zdb.8
1 '\" t
2 .\"
3 .\" This file and its contents are supplied under the terms of the
4 .\" Common Development and Distribution License ("CDDL"), version 1.0.
5 .\" You may only use this file in accordance with the terms of version
6 .\" 1.0 of the CDDL.
7 .\"
8 .\" A full copy of the text of the CDDL should have accompanied this
9 .\" source.  A copy of the CDDL is also available via the Internet at
10 .\" http://www.illumos.org/license/CDDL.
11 .\"
12 .\"
13 .\" Copyright 2012, Richard Lowe.
14 .\" Copyright (c) 2012 by Delphix. All rights reserved.
15 .\"
16 .TH "ZDB" "8" "February 15, 2012" "" ""
17
18 .SH "NAME"
19 \fBzdb\fR - Display zpool debugging and consistency information
20
21 .SH "SYNOPSIS"
22 \fBzdb\fR [-CumdibcsDvhLXFPA] [-e [-p \fIpath\fR...]] [-t \fItxg\fR]
23     [-U \fIcache\fR] [-M \fIinflight I/Os\fR] [\fIpoolname\fR
24     [\fIobject\fR ...]]
25
26 .P
27 \fBzdb\fR [-divPA] [-e [-p \fIpath\fR...]] [-U \fIcache\fR]
28     \fIdataset\fR [\fIobject\fR ...]
29
30 .P
31 \fBzdb\fR -m [-LXFPA] [-t \fItxg\fR] [-e [-p \fIpath\fR...]] [-U \fIcache\fR]
32     \fIpoolname\fR [\fIvdev\fR [\fImetaslab\fR ...]]
33
34 .P
35 \fBzdb\fR -R [-A] [-e [-p \fIpath\fR...]] [-U \fIcache\fR] \fIpoolname\fR
36     \fIvdev\fR:\fIoffset\fR:\fIsize\fR[:\fIflags\fR]
37
38 .P
39 \fBzdb\fR -S [-AP] [-e [-p \fIpath\fR...]] [-U \fIcache\fR] \fIpoolname\fR
40
41 .P
42 \fBzdb\fR -l [-uA] \fIdevice\fR
43
44 .P
45 \fBzdb\fR -C [-A] [-U \fIcache\fR]
46
47 .SH "DESCRIPTION"
48 The \fBzdb\fR utility displays information about a ZFS pool useful for
49 debugging and performs some amount of consistency checking. It is a not a
50 general purpose tool and options (and facilities) may change. This is neither
51 a fsck(8) nor an fsdb(8) utility.
52
53 .P
54 The output of this command in general reflects the on-disk structure of a ZFS
55 pool, and is inherently unstable. The precise output of most invocations is
56 not documented, a knowledge of ZFS internals is assumed.
57
58 .P
59 When operating on an imported and active pool it is possible, though unlikely,
60 that zdb may interpret inconsistent pool data and behave erratically.
61
62 .SH "OPTIONS"
63 Display options:
64
65 .sp
66 .ne 2
67 .na
68 \fB-b\fR
69 .ad
70 .sp .6
71 .RS 4n
72 Display statistics regarding the number, size (logical, physical and
73 allocated) and deduplication of blocks.
74 .RE
75
76 .sp
77 .ne 2
78 .na
79 \fB-c\fR
80 .ad
81 .sp .6
82 .RS 4n
83 Verify the checksum of all metadata blocks while printing block statistics
84 (see \fB-b\fR).
85 .sp
86 If specified multiple times, verify the checksums of all blocks.
87 .RE
88
89 .sp
90 .ne 2
91 .na
92 \fB-C\fR
93 .ad
94 .sp .6
95 .RS 4n
96 Display information about the configuration. If specified with no other
97 options, instead display information about the cache file
98 (\fB/etc/zfs/zpool.cache\fR). To specify the cache file to display, see
99 \fB-U\fR.
100 .P
101 If specified multiple times, and a pool name is also specified display both
102 the cached configuration and the on-disk configuration.  If specified multiple
103 times with \fB-e\fR also display the configuration that would be used were the
104 pool to be imported.
105 .RE
106
107 .sp
108 .ne 2
109 .na
110 \fB-d\fR
111 .ad
112 .sp .6
113 .RS 4n
114 Display information about datasets. Specified once, displays basic dataset
115 information: ID, create transaction, size, and object count.
116 .sp
117 If specified multiple times provides greater and greater verbosity.
118 .sp
119 If object IDs are specified, display information about those specific objects only.
120 .RE
121
122 .sp
123 .ne 2
124 .na
125 \fB-D\fR
126 .ad
127 .sp .6
128 .RS 4n
129 Display deduplication statistics, including the deduplication ratio (dedup),
130 compression ratio (compress), inflation due to the zfs copies property
131 (copies), and an overall effective ratio (dedup * compress / copies).
132 .sp
133 If specified twice, display a histogram of deduplication statistics, showing
134 the allocated (physically present on disk) and referenced (logically
135 referenced in the pool) block counts and sizes by reference count.
136 .RE
137
138 .sp
139 .ne 2
140 .na
141 \fB-h\fR
142 .ad
143 .sp .6
144 .RS 4n
145 Display pool history similar to \fBzpool history\fR, but include internal
146 changes, transaction, and dataset information.
147 .RE
148
149 .sp
150 .ne 2
151 .na
152 \fB-i\fR
153 .ad
154 .sp .6
155 .RS 4n
156 Display information about intent log (ZIL) entries relating to each
157 dataset. If specified multiple times, display counts of each intent log
158 transaction type.
159 .RE
160
161 .sp
162 .ne 2
163 .na
164 \fB-l\fR \fIdevice\fR
165 .ad
166 .sp .6
167 .RS 4n
168 Display the vdev labels from the specified device. If the \fB-u\fR option is
169 also specified, also display the uberblocks on this device.
170 .RE
171
172 .sp
173 .ne 2
174 .na
175 \fB-L\fR
176 .ad
177 .sp .6
178 .RS 4n
179 Disable leak tracing and the loading of space maps.  By default, \fBzdb\fR
180 verifies that all non-free blocks are referenced, which can be very expensive.
181 .RE
182
183 .sp
184 .ne 2
185 .na
186 \fB-m\fR
187 .ad
188 .sp .6
189 .RS 4n
190 Display the offset, spacemap, and free space of each metaslab.
191 When specified twice, also display information about the maximum contiguous
192 free space and the percentage of free space in each space map.  When specified
193 three times display every spacemap record.
194 .RE
195
196 .sp
197 .ne 2
198 .na
199 \fB-R\fR \fIpoolname\fR \fIvdev\fR:\fIoffset\fR:\fIsize\fR[:\fIflags\fR]
200 .ad
201 .sp .6
202 .RS 4n
203 Read and display a block from the specified device. By default the block is
204 displayed as a hex dump, but see the description of the \'r\' flag, below.
205 .sp
206 The block is specified in terms of a colon-separated tuple \fIvdev\fR (an
207 integer vdev identifier) \fIoffset\fR (the offset within the vdev) \fIsize\fR
208 (the size of the block to read) and, optionally, \fIflags\fR (a set of flags,
209 described below).
210
211 .sp
212 .ne 2
213 .na
214 \fBb\fR \fIoffset\fR
215 .ad
216 .sp .6
217 .RS 4n
218 Print block pointer
219 .RE
220
221 .sp
222 .ne 2
223 .na
224 \fBd\fR
225 .ad
226 .sp .6
227 .RS 4n
228 Decompress the block
229 .RE
230
231 .sp
232 .ne 2
233 .na
234 \fBe\fR
235 .ad
236 .sp .6
237 .RS 4n
238 Byte swap the block
239 .RE
240
241 .sp
242 .ne 2
243 .na
244 \fBg\fR
245 .ad
246 .sp .6
247 .RS 4n
248 Dump gang block header
249 .RE
250
251 .sp
252 .ne 2
253 .na
254 \fBi\fR
255 .ad
256 .sp .6
257 .RS 4n
258 Dump indirect block
259 .RE
260
261 .sp
262 .ne 2
263 .na
264 \fBr\fR
265 .ad
266 .sp .6
267 .RS 4n
268 Dump raw uninterpreted block data
269 .RE
270 .RE
271
272 .sp
273 .ne 2
274 .na
275 \fB-s\fR
276 .ad
277 .sp .6
278 .RS 4n
279 Report statistics on \fBzdb\fR\'s I/O. Display operation counts, bandwidth,
280 and error counts of I/O to the pool from \fBzdb\fR.
281 .RE
282
283 .sp
284 .ne 2
285 .na
286 \fB-S\fR
287 .ad
288 .sp .6
289 .RS 4n
290 Simulate the effects of deduplication, constructing a DDT and then display
291 that DDT as with \fB-DD\fR.
292 .RE
293
294 .sp
295 .ne 2
296 .na
297 \fB-u\fR
298 .ad
299 .sp .6
300 .RS 4n
301 Display the current uberblock.
302 .RE
303
304 .P
305 Other options:
306
307 .sp
308 .ne 2
309 .na
310 \fB-A\fR
311 .ad
312 .sp .6
313 .RS 4n
314 Do not abort should any assertion fail.
315 .RE
316
317 .sp
318 .ne 2
319 .na
320 \fB-AA\fR
321 .ad
322 .sp .6
323 .RS 4n
324 Enable panic recovery, certain errors which would otherwise be fatal are
325 demoted to warnings.
326 .RE
327
328 .sp
329 .ne 2
330 .na
331 \fB-AAA\fR
332 .ad
333 .sp .6
334 .RS 4n
335 Do not abort if asserts fail and also enable panic recovery.
336 .RE
337
338 .sp
339 .ne 2
340 .na
341 \fB-e\fR [-p \fIpath\fR]...
342 .ad
343 .sp .6
344 .RS 4n
345 Operate on an exported pool, not present in \fB/etc/zfs/zpool.cache\fR. The
346 \fB-p\fR flag specifies the path under which devices are to be searched.
347 .RE
348
349 .sp
350 .ne 2
351 .na
352 \fB-F\fR
353 .ad
354 .sp .6
355 .RS 4n
356 Attempt to make an unreadable pool readable by trying progressively older
357 transactions.
358 .RE
359
360 .sp
361 .ne 2
362 .na
363 \fB-M \fIinflight I/Os\fR \fR
364 .ad
365 .sp .6
366 .RS 4n
367 Limit the number of outstanding checksum I/Os to the specified value. The
368 default value is 200. This option affects the performance of the \fB-c\fR
369 option.
370 .RE
371
372 .sp
373 .ne 2
374 .na
375 \fB-P\fR
376 .ad
377 .sp .6
378 .RS 4n
379 Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather
380 than 1M.
381 .RE
382
383 .sp
384 .ne 2
385 .na
386 \fB-t\fR \fItransaction\fR
387 .ad
388 .sp .6
389 .RS 4n
390 Specify the highest transaction to use when searching for uberblocks. See also
391 the \fB-u\fR and \fB-l\fR options for a means to see the available uberblocks
392 and their associated transaction numbers.
393 .RE
394
395 .sp
396 .ne 2
397 .na
398 \fB-U\fR \fIcachefile\fR
399 .ad
400 .sp .6
401 .RS 4n
402 Use a cache file other than \fB/etc/zfs/zpool.cache\fR.
403 .RE
404
405 .sp
406 .ne 2
407 .na
408 \fB-v\fR
409 .ad
410 .sp .6
411 .RS 4n
412 Enable verbosity. Specify multiple times for increased verbosity.
413 .RE
414
415 .sp
416 .ne 2
417 .na
418 \fB-X\fR
419 .ad
420 .sp .6
421 .RS 4n
422 Attempt \'extreme\' transaction rewind, that is attempt the same recovery as
423 \fB-F\fR but read transactions otherwise deemed too old.
424 .RE
425
426 .P
427 Specifying a display option more than once enables verbosity for only that
428 option, with more occurrences enabling more verbosity.
429 .P
430 If no options are specified, all information about the named pool will be
431 displayed at default verbosity.
432
433 .SH "EXAMPLES"
434 .LP
435 \fBExample 1 \fRDisplay the configuration of imported pool 'rpool'
436 .sp
437 .in +2
438 .nf
439 # zdb -C rpool
440
441 MOS Configuration:
442         version: 28
443         name: 'rpool'
444  ...
445 .fi
446 .in -2
447 .sp
448
449 .LP
450 \fBExample 2 \fRDisplay basic dataset information about 'rpool'
451 .sp
452 .in +2
453 .nf
454 # zdb -d rpool
455 Dataset mos [META], ID 0, cr_txg 4, 26.9M, 1051 objects
456 Dataset rpool/swap [ZVOL], ID 59, cr_txg 356, 486M, 2 objects
457  ...
458 .fi
459 .in -2
460 .sp
461
462 .LP
463 \fBExample 3 \fRDisplay basic information about object 0
464 in 'rpool/export/home'
465 .sp
466 .in +2
467 .nf
468 # zdb -d rpool/export/home 0
469 Dataset rpool/export/home [ZPL], ID 137, cr_txg 1546, 32K, 8 objects
470
471     Object  lvl   iblk   dblk  dsize  lsize   %full  type
472          0    7    16K    16K  15.0K    16K   25.00  DMU dnode
473 .fi
474 .in -2
475 .sp
476
477 .LP
478 \fBExample 4 \fRDisplay the predicted effect of enabling deduplication on 'rpool'
479 .sp
480 .in +2
481 .nf
482 # zdb -S rpool
483 Simulated DDT histogram:
484
485 bucket              allocated                       referenced          
486 ______   ______________________________   ______________________________
487 refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
488 ------   ------   -----   -----   -----   ------   -----   -----   -----
489      1     694K   27.1G   15.0G   15.0G     694K   27.1G   15.0G   15.0G
490      2    35.0K   1.33G    699M    699M    74.7K   2.79G   1.45G   1.45G
491  ...
492 dedup = 1.11, compress = 1.80, copies = 1.00, dedup * compress / copies = 2.00
493 .fi
494 .in -2
495 .sp
496
497 .SH "SEE ALSO"
498 zfs(8), zpool(8)