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