1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
'\" te
.\" Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>.
.\" All Rights Reserved.
.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2012, Richard Lowe.
.\" Copyright (c) 2012, Marcelo Araujo <araujo@FreeBSD.org>.
.\" Copyright (c) 2012, 2014 by Delphix. All rights reserved.
.\" All Rights Reserved.
.\"
.\" $FreeBSD$
.\"
.Dd July 1, 2014
.Dt ZDB 8
.Os
.Sh NAME
.Nm zdb
.Nd Display zpool debugging and consistency information
.Sh SYNOPSIS
.Nm
.Op Fl CumdibcsDvhLXFPA
.Op Fl e Op Fl p Ar path...
.Op Fl t Ar txg
.Op Fl U Ar cache
.Op Fl M Ar inflight I/Os
.Op Fl x Ar dumpdir
.Ar poolname
.Op Ar object ...
.Nm
.Op Fl divPA
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar dataset
.Op Ar object ...
.Nm
.Fl m Op Fl LXFPA
.Op Fl t Ar txg
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Nm
.Fl R Op Fl A
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Ar poolname
.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
.Nm
.Fl S
.Op Fl AP
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Ar poolname
.Nm
.Fl l
.Op Fl uA
.Ar device
.Nm
.Fl C
.Op Fl A
.Op Fl U Ar cache
.Sh DESCRIPTION
The
.Nm
utility displays information about a ZFS pool useful for debugging and
performs some amount of consistency checking.
It is a not a general purpose tool and options (and facilities) may change.
This is neither a
.Xr fsck 8
nor a
.Xr fsdb 8
utility.
.Pp
The output of this command in general reflects the on-disk structure of a ZFS
pool, and is inherently unstable.
The precise output of most invocations is not documented, a knowledge of ZFS
internals is assumed.
.Pp
When operating on an imported and active pool it is possible, though unlikely,
that zdb may interpret inconsistent pool data and behave erratically.
.Sh OPTIONS
Display options:
.Bl -tag -width indent
.It Fl b
Display statistics regarding the number, size (logical, physical and
allocated) and deduplication of blocks.
.It Fl c
Verify the checksum of all metadata blocks while printing block statistics
(see
.Fl b Ns ).
.Pp
If specified multiple times, verify the checksums of all blocks.
.It Fl C
Display information about the configuration. If specified with no other
options, instead display information about the cache file
.Po Pa /etc/zfs/zpool.cache Pc .
To specify the cache file to display, see
.Fl U
.Pp
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
.Fl e
also display the configuration that would be used were the pool to be
imported.
.It Fl d
Display information about datasets. Specified once, displays basic dataset
information: ID, create transaction, size, and object count.
.Pp
If specified multiple times provides greater and greater verbosity.
.Pp
If object IDs are specified, display information about those specific objects only.
.It Fl D
Display deduplication statistics, including the deduplication ratio (dedup),
compression ratio (compress), inflation due to the zfs copies property
(copies), and an overall effective ratio (dedup * compress / copies).
.Pp
If specified twice, 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.
.Pp
If specified a third time, display the statistics independently for each deduplication table.
.Pp
If specified a fourth time, dump the contents of the deduplication tables describing duplicate blocks.
.Pp
If specified a fifth time, also dump the contents of the deduplication tables describing unique blocks.
.It Fl h
Display pool history similar to
.Cm zpool history ,
but include internal changes, transaction, and dataset information.
.It Fl i
Display information about intent log (ZIL) entries relating to each
dataset.
If specified multiple times, display counts of each intent log transaction
type.
.It Fl l Ar device
Display the vdev labels from the specified device.
If the
.Fl u
option is also specified, also display the uberblocks on this device.
.It Fl L
Disable leak tracing and the loading of space maps.
By default,
.Nm
verifies that all non-free blocks are referenced, which can be very expensive.
.It Fl m
Display the offset, spacemap, and free space of each metaslab.
When specified twice, also display information about the maximum contiguous
free space and the percentage of free space in each space map.
When specified three times display every spacemap record.
.It Xo
.Fl R Ar poolname
.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
.Xc
Read and display a block from the specified device. By default the block is
displayed as a hex dump, but see the description of the
.Fl r
flag, below.
.Pp
The block is specified in terms of a colon-separated tuple
.Ar vdev
(an integer vdev identifier)
.Ar offset
(the offset within the vdev)
.Ar size
(the size of the block to read) and, optionally,
.Ar flags
(a set of flags, described below).
.Bl -tag -width indent
.It Sy b offset
Print block pointer
.It Sy d
Decompress the block
.It Sy e
Byte swap the block
.It Sy g
Dump gang block header
.It Sy i
Dump indirect block
.It Sy r
Dump raw uninterpreted block data
.El
.It Fl s
Report statistics on
.Nm Ns 's
I/O.
Display operation counts, bandwidth, and error counts of I/O to the pool from
.Nm .
.It Fl S
Simulate the effects of deduplication, constructing a DDT and then display
that DDT as with \fB-DD\fR.
.It Fl u
Display the current uberblock.
.El
.Pp
Other options:
.Bl -tag -width indent
.It Fl A
Do not abort should any assertion fail.
.It Fl AA
Enable panic recovery, certain errors which would otherwise be fatal are
demoted to warnings.
.It Fl AAA
Do not abort if asserts fail and also enable panic recovery.
.It Fl e Op Fl p Ar path...
Operate on an exported pool, not present in
.Pa /etc/zfs/zpool.cache .
The
.Fl p
flag specifies the path under which devices are to be searched.
.It Fl x Ar 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 be then run on the generated files.
Note that the
.Fl bbc
flags are sufficient to access (and thus copy)
all metadata on the pool.
.It Fl F
Attempt to make an unreadable pool readable by trying progressively older
transactions.
.It Fl M Ar inflight I/Os
Limit the number of outstanding checksum I/Os to the specified value.
The default value is 200. This option affects the performance of the
.Fl c
option.
.It Fl P
Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather
than 1M.
.It Fl t Ar transaction
Specify the highest transaction to use when searching for uberblocks.
See also the
.Fl u
and
.Fl l
options for a means to see the available uberblocks and their associated
transaction numbers.
.It Fl U Ar cachefile
Use a cache file other than
.Pa /boot/zfs/zpool.cache .
.It Fl v
Enable verbosity.
Specify multiple times for increased verbosity.
.It Fl X
Attempt
.Ql extreme
transaction rewind, that is attempt the same recovery as
.Fl F
but read transactions otherwise deemed too old.
.El
.Pp
Specifying a display option more than once enables verbosity for only that
option, with more occurrences enabling more verbosity.
.Pp
If no options are specified, all information about the named pool will be
displayed at default verbosity.
.Sh EXAMPLES
.Bl -tag -width 0n
.It Sy Example 1 Display the configuration of imported pool 'rpool'
.Bd -literal -offset 2n
.Li # Ic zdb -C rpool
MOS Configuration:
version: 28
name: 'rpool'
...
.Ed
.It Sy Example 2 Display basic dataset information about 'rpool'
.Bd -literal -offset 2n
.Li # Ic 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
...
.Ed
.It Xo Sy Example 3 Display basic information about object 0 in
.Sy 'rpool/export/home'
.Xc
.Bd -literal -offset 2n
.Li # Ic 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
.Ed
.It Xo Sy Example 4 Display the predicted effect of enabling deduplication on
.Sy 'rpool'
.Xc
.Bd -literal -offset 2n
.Li # Ic 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
.Ed
.El
.Sh SEE ALSO
.Xr zfs 8 ,
.Xr zpool 8
.Sh AUTHORS
This manual page is a
.Xr mdoc 7
reimplementation of the
.Tn illumos
manual page
.Em zdb(1M) ,
modified and customized for
.Fx
and licensed under the
Common Development and Distribution License
.Pq Tn CDDL .
.Pp
The
.Xr mdoc 7
implementation of this manual page was initially written by
.An Martin Matuska Aq mm@FreeBSD.org
and
.An Marcelo Araujo Aq araujo@FreeBSD.org .
|