summaryrefslogtreecommitdiff
path: root/Documentation/btrfs-inspect-internal.8
blob: 156a96a94172a666e25c30aef96898d1eac2627c (plain)
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
'\" t
.\"     Title: btrfs-inspect-internal
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 01/23/2019
.\"    Manual: Btrfs Manual
.\"    Source: Btrfs v4.20.1
.\"  Language: English
.\"
.TH "BTRFS\-INSPECT\-INTE" "8" "01/23/2019" "Btrfs v4\&.20\&.1" "Btrfs Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
btrfs-inspect-internal \- query various internal information
.SH "SYNOPSIS"
.sp
\fBbtrfs inspect\-internal\fR \fI<subcommand>\fR \fI<args>\fR
.SH "DESCRIPTION"
.sp
This command group provides an interface to query internal information\&. The functionality ranges from a simple UI to an ioctl or a more complex query that assembles the result from several internal structures\&. The latter usually requires calls to privileged ioctls\&.
.SH "SUBCOMMAND"
.PP
\fBdump\-super\fR [options] \fI<device>\fR [device\&...]
.RS 4
(replaces the standalone tool
\fBbtrfs\-show\-super\fR)
.sp
Show btrfs superblock information stored on given devices in textual form\&. By default the first superblock is printed, more details about all copies or additional backup data can be printed\&.
.sp
Besides verification of the filesystem signature, there are no other sanity checks\&. The superblock checksum status is reported, the device item and filesystem UUIDs are checked and reported\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
the meaning of option
\fI\-s\fR
has changed in version 4\&.8 to be consistent with other tools to specify superblock copy rather the offset\&. The old way still works, but prints a warning\&. Please update your scripts to use
\fI\-\-bytenr\fR
instead\&. The option
\fI\-i\fR
has been deprecated\&.
.sp .5v
.RE
\fBOptions\fR
.PP
\-f|\-\-full
.RS 4
print full superblock information, including the system chunk array and backup roots
.RE
.PP
\-a|\-\-all
.RS 4
print information about all present superblock copies (cannot be used together with
\fI\-s\fR
option)
.RE
.PP
\-i \fI<super>\fR
.RS 4
(deprecated since 4\&.8, same behaviour as
\fI\-\-super\fR)
.RE
.PP
\-\-bytenr \fI<bytenr>\fR
.RS 4
specify offset to a superblock in a non\-standard location at
\fIbytenr\fR, useful for debugging (disables the
\fI\-f\fR
option)
.sp
If there are multiple options specified, only the last one applies\&.
.RE
.PP
\-F|\-\-force
.RS 4
attempt to print the superblock even if a valid BTRFS signature is not found; the result may be completely wrong if the data does not resemble a superblock
.RE
.PP
\-s|\-\-super \fI<bytenr>\fR
.RS 4
(see compatibility note above)
.sp
specify which mirror to print, valid values are 0, 1 and 2 and the superblock must be present on the device with a valid signature, can be used together with
\fI\-\-force\fR
.RE
.RE
.PP
\fBdump\-tree\fR [options] \fI<device>\fR
.RS 4
(replaces the standalone tool
\fBbtrfs\-debug\-tree\fR)
.sp
Dump tree structures from a given device in textual form, expand keys to human readable equivalents where possible\&. This is useful for analyzing filesystem state or inconsistencies and has a positive educational effect on understanding the internal filesystem structure\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
contains file names, consider that if you\(cqre asked to send the dump for analysis\&. Does not contain file data\&.
.sp .5v
.RE
\fBOptions\fR
.PP
\-e|\-\-extents
.RS 4
print only extent\-related information: extent and device trees
.RE
.PP
\-d|\-\-device
.RS 4
print only device\-related information: tree root, chunk and device trees
.RE
.PP
\-r|\-\-roots
.RS 4
print only short root node information, ie\&. the root tree keys
.RE
.PP
\-R|\-\-backups
.RS 4
same as \-\-roots plus print backup root info, ie\&. the backup root keys and the respective tree root block offset
.RE
.PP
\-u|\-\-uuid
.RS 4
print only the uuid tree information, empty output if the tree does not exist
.RE
.PP
\-b \fI<block_num>\fR
.RS 4
print info of the specified block only
.RE
.PP
\-\-follow
.RS 4
use with
\fI\-b\fR, print all children tree blocks of
\fI\fI<block_num>\fR\fR
.RE
.PP
\-\-dfs
.RS 4
use depth\-first search to print trees\&. (default) the nodes and leaves are intermixed in the output
.RE
.PP
\-\-bfs
.RS 4
use breadth\-first search to print trees\&. the nodes are printed before all leaves
.RE
.PP
\-t \fI<tree_id>\fR
.RS 4
print only the tree with the specified ID, where the ID can be numerical or common name in a flexible human readable form
.sp
The tree id name recognition rules:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
case does not matter
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
the C source definition, eg\&. BTRFS_ROOT_TREE_OBJECTID
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
short forms without BTRFS_ prefix, without _TREE and _OBJECTID suffix, eg\&. ROOT_TREE, ROOT
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
convenience aliases, eg\&. DEVICE for the DEV tree, CHECKSUM for CSUM
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
unrecognized ID is an error
.RE
.RE
.RE
.PP
\fBinode\-resolve\fR [\-v] \fI<ino>\fR \fI<path>\fR
.RS 4
(needs root privileges)
.sp
resolve paths to all files with given inode number
\fIino\fR
in a given subvolume at
\fIpath\fR, ie\&. all hardlinks
.sp
\fBOptions\fR
.PP
\-v
.RS 4
verbose mode, print count of returned paths and ioctl() return value
.RE
.RE
.PP
\fBlogical\-resolve\fR [\-Pv] [\-s \fI<bufsize>\fR] \fI<logical>\fR \fI<path>\fR
.RS 4
(needs root privileges)
.sp
resolve paths to all files at given
\fIlogical\fR
address in the linear filesystem space
.sp
\fBOptions\fR
.PP
\-P
.RS 4
skip the path resolving and print the inodes instead
.RE
.PP
\-v
.RS 4
verbose mode, print count of returned paths and all ioctl() return values
.RE
.PP
\-s \fI<bufsize>\fR
.RS 4
set internal buffer for storing the file names to
\fIbufsize\fR, default is 4096, maximum 64k
.RE
.RE
.PP
\fBmin\-dev\-size\fR [options] \fI<path>\fR
.RS 4
(needs root privileges)
.sp
return the minimum size the device can be shrunk to, without performing any resize operation, this may be useful before executing the actual resize operation
.sp
\fBOptions\fR
.PP
\-\-id \fI<id>\fR
.RS 4
specify the device
\fIid\fR
to query, default is 1 if this option is not used
.RE
.RE
.PP
\fBrootid\fR \fI<path>\fR
.RS 4
for a given file or directory, return the containing tree root id, but for a subvolume itself return its own tree id (ie\&. subvol id)
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
The result is undefined for the so\-called empty subvolumes (identified by inode number 2), but such a subvolume does not contain any files anyway
.sp .5v
.RE
.RE
.PP
\fBsubvolid\-resolve\fR \fI<subvolid>\fR \fI<path>\fR
.RS 4
(needs root privileges)
.sp
resolve the absolute path of the subvolume id
\fIsubvolid\fR
.RE
.PP
\fBtree\-stats\fR [options] \fI<device>\fR
.RS 4
(needs root privileges)
.sp
Print sizes and statistics of trees\&.
.sp
\fBOptions\fR
.PP
\-b
.RS 4
Print raw numbers in bytes\&.
.RE
.RE
.SH "EXIT STATUS"
.sp
\fBbtrfs inspect\-internal\fR returns a zero exit status if it succeeds\&. Non zero is returned in case of failure\&.
.SH "AVAILABILITY"
.sp
\fBbtrfs\fR is part of btrfs\-progs\&. Please refer to the btrfs wiki \m[blue]\fBhttp://btrfs\&.wiki\&.kernel\&.org\fR\m[] for further details\&.
.SH "SEE ALSO"
.sp
\fBmkfs\&.btrfs\fR(8)