e072a943f825dd58b2299b04babe789a7850c77f
[platform/upstream/btrfs-progs.git] / Documentation / btrfs-inspect-internal.asciidoc
1 btrfs-inspect-internal(8)
2 =========================
3
4 NAME
5 ----
6 btrfs-inspect-internal - query various internal information
7
8 SYNOPSIS
9 --------
10 *btrfs inspect-internal* <subcommand> <args>
11
12 DESCRIPTION
13 -----------
14
15 This command group provides an interface to query internal information. The
16 functionality ranges from a simple UI to an ioctl or a more complex query that
17 assembles the result from several internal structures. The latter usually
18 requires calls to privileged ioctls.
19
20 SUBCOMMAND
21 ----------
22 *dump-super* [options] <device> [device...]::
23 (replaces the standalone tool *btrfs-show-super*)
24 +
25 Show btrfs superblock information stored on given devices in textual form.
26 By default the first superblock is printed, more details about all copies or
27 additional backup data can be printed.
28 +
29 Besides verification of the filesystem signature, there are no other sanity
30 checks. The superblock checksum status is reported, the device item and
31 filesystem UUIDs are checked and reported.
32 +
33 NOTE: the meaning of option '-s' has changed in version 4.8 to be consistent
34 with other tools to specify superblock copy rather the offset. The old way still
35 works, but prints a warning. Please update your scripts to use '--bytenr'
36 instead. The option '-i' has been deprecated.
37 +
38 `Options`
39 +
40 -f|--full::::
41 print full superblock information, including the system chunk array and backup roots
42 -a|--all::::
43 print information about all present superblock copies (cannot be used together
44 with '-s' option)
45 -i <super>::::
46 (deprecated since 4.8, same behaviour as '--super')
47 --bytenr <bytenr>::::
48 specify offset to a superblock in a non-standard location at 'bytenr', useful
49 for debugging (disables the '-f' option)
50 +
51 If there are multiple options specified, only the last one applies.
52 +
53 -F|--force::::
54 attempt to print the superblock even if a valid BTRFS signature is not found;
55 the result may be completely wrong if the data does not resemble a superblock
56 +
57 -s|--super <bytenr>::::
58 (see compatibility note above)
59 +
60 specify which mirror to print, valid values are 0, 1 and 2 and the superblock
61 must be present on the device with a valid signature, can be used together with
62 '--force'
63
64 *dump-tree* [options] <device>::
65 (replaces the standalone tool *btrfs-debug-tree*)
66 +
67 Dump tree structures from a given device in textual form, expand keys to human
68 readable equivalents where possible.
69 This is useful for analyzing filesystem state or inconsistencies and has
70 a positive educational effect on understanding the internal filesystem structure.
71 +
72 NOTE: contains file names, consider that if you're asked to send the dump for
73 analysis. Does not contain file data.
74 +
75 `Options`
76 +
77 -e|--extents::::
78 print only extent-related information: extent and device trees
79 -d|--device::::
80 print only device-related information: tree root, chunk and device trees
81 -r|--roots::::
82 print only short root node information, ie. the root tree keys
83 -R|--backups::::
84 same as --roots plus print backup root info, ie. the backup root keys and
85 the respective tree root block offset
86 -u|--uuid::::
87 print only the uuid tree information, empty output if the tree does not exist
88 -b <block_num>::::
89 print info of the specified block only
90 -t <tree_id>::::
91 print only the tree with the specified ID, where the ID can be numerical or
92 common name in a flexible human readable form
93 +
94 The tree id name recognition rules:
95 [options="compact"]
96 * case does not matter
97 * the C source definition, eg. BTRFS_ROOT_TREE_OBJECTID
98 * short forms without BTRFS_ prefix, without _TREE and _OBJECTID suffix, eg. ROOT_TREE, ROOT
99 * convenience aliases, eg. DEVICE for the DEV tree, CHECKSUM for CSUM
100 * unrecognized ID is an error
101
102 *inode-resolve* [-v] <ino> <path>::
103 (needs root privileges)
104 +
105 resolve paths to all files with given inode number 'ino' in a given subvolume
106 at 'path', ie. all hardlinks
107 +
108 `Options`
109 +
110 -v::::
111 verbose mode, print count of returned paths and ioctl() return value
112
113 *logical-resolve* [-Pv] [-s <bufsize>] <logical> <path>::
114 (needs root privileges)
115 +
116 resolve paths to all files at given 'logical' address in the linear filesystem space
117 +
118 `Options`
119 +
120 -P::::
121 skip the path resolving and print the inodes instead
122 -v::::
123 verbose mode, print count of returned paths and all ioctl() return values
124 -s <bufsize>::::
125 set internal buffer for storing the file names to 'bufsize', default is 4096, maximum 64k
126
127 *min-dev-size* [options] <path>::
128 (needs root privileges)
129 +
130 return the minimum size the device can be shrunk to, without performing any
131 resize operation, this may be useful before executing the actual resize operation
132 +
133 `Options`
134 +
135 --id <id>::::
136 specify the device 'id' to query, default is 1 if this option is not used
137
138 *rootid* <path>::
139 for a given file or directory, return the containing tree root id, but for a
140 subvolume itself return its own tree id (ie. subvol id)
141 +
142 NOTE: The result is undefined for the so-called empty subvolumes (identified by
143 inode number 2), but such a subvolume does not contain any files anyway
144
145 *subvolid-resolve* <subvolid> <path>::
146 (needs root privileges)
147 +
148 resolve the absolute path of the subvolume id 'subvolid'
149
150 *tree-stats* [options] <device>::
151 (needs root privileges)
152 +
153 Print sizes and statistics of trees.
154 +
155 `Options`
156 +
157 -b::::
158 Print raw numbers in bytes.
159
160 EXIT STATUS
161 -----------
162 *btrfs inspect-internal* returns a zero exit status if it succeeds. Non zero is
163 returned in case of failure.
164
165 AVAILABILITY
166 ------------
167 *btrfs* is part of btrfs-progs.
168 Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for
169 further details.
170
171 SEE ALSO
172 --------
173 `mkfs.btrfs`(8)