]>
Commit | Line | Data |
---|---|---|
2bd0ea18 NS |
1 | .TH xfs_db 8 |
2 | .SH NAME | |
3 | xfs_db \- debug an XFS filesystem | |
4 | .SH SYNOPSIS | |
5 | .nf | |
6 | \f3xfs_db\f1 [ \f3\-c\f1 cmd ] ... [ \f3\-p\f1 prog ] [ \f3\-r\f1 ] [ \f3\-x\f1 ] xfs_special | |
7 | .sp .8v | |
8 | \f3xfs_db\f1 \f3\-f\f1 [ \f3\-c\f1 cmd ] ... [ \f3\-p\f1 prog ] [ \f3\-f\f1 ] [ \f3\-r\f1 ] [ \f3\-x\f1 ] file | |
9 | .fi | |
10 | .SH DESCRIPTION | |
11 | \f2xfs_db\f1 is used to examine an XFS filesystem. | |
12 | Under rare circumstances it can also be used to modify an XFS filesystem, | |
13 | but that task is normally left to \f2xfs_repair\f1(8) or to | |
42cf2b97 | 14 | scripts such as \f2xfs_admin\f1 that run \f2xfs_db\f1. |
2bd0ea18 NS |
15 | .PP |
16 | The options to \f2xfs_db\f1 are: | |
17 | .TP 10 | |
18 | \f3\-c\f1 \f2cmd\f1 | |
19 | \f2xfs_db\f1 commands may be run interactively (the default) | |
20 | or as arguments on the command line. | |
21 | Multiple \f3\-c\f1 arguments may be given. | |
22 | The commands are run in the sequence given, then the program exits. | |
23 | This is the mechanism used to implement \f2xfs_check\f1(8). | |
24 | .TP | |
25 | \f3\-f\f1 | |
d2df702b | 26 | Specifies that the filesystem image to be processed is stored in a |
2bd0ea18 NS |
27 | regular file |
28 | (see the \f2mkfs.xfs\f1 \f3\-d\f1 \f2file\f1 option). | |
29 | This might happen if an image copy | |
30 | of a filesystem has been made into an ordinary file with \f2xfs_copy\f1(8). | |
31 | .TP | |
cc01ba7a NS |
32 | .B \-l |
33 | Specifies the device special file where the filesystems external | |
34 | log resides. | |
35 | Only for those filesystems which use an external log. | |
36 | See the | |
37 | \f2mkfs.xfs\f1 \f3\-l\f1 option, and refer to | |
38 | .IR xfs (5) | |
39 | for a detailed description of the XFS log. | |
40 | .TP | |
2bd0ea18 NS |
41 | \f3\-i\f1 |
42 | Allows execution on a mounted filesystem, provided it is mounted read-only. | |
43 | Useful for shell scripts such as \f2xfs_check\f1(8), which must only | |
44 | operate on filesystems in a guarenteed consistent state | |
45 | (either unmounted or mounted read-only). | |
46 | These semantics are slightly different to that of the \f3\-r\f1 option. | |
47 | .TP | |
48 | \f3\-p\f1 \f2prog\f1 | |
49 | Set the program name for prompts and some error messages, | |
50 | the default value is \f2xfs_db\f1. | |
51 | .TP | |
52 | \f3\-r\f1 | |
53 | Open \f2file\f1 or \f2xfs_special\f1 read-only. | |
54 | This option is required if \f2xfs_special\f1 is a mounted filesystem. | |
55 | It is only necessary to omit this flag if a command that changes data | |
56 | (\f3write\f1, \f3blocktrash\f1) is to be used. | |
57 | .TP | |
58 | \f3\-x\f1 | |
59 | Specifies expert mode. | |
60 | This enables the \f3write\f1 command. | |
61 | .SH CONCEPTS | |
62 | \f2xfs_db\f1 commands can be broken up into two classes. | |
63 | Most commands are for the navigation and display of data structures in | |
64 | the filesystem. | |
65 | Other commands are for scanning the filesystem in some way. | |
66 | .PP | |
67 | Commands which are used to navigate the filesystem structure take arguments | |
68 | which reflect the names of filesystem structure fields. | |
69 | There can be multiple field names separated by dots when the underlying | |
70 | structures are nested, as in C. | |
71 | The field names can be indexed (as an array index) | |
72 | if the underlying field is an array. | |
73 | The array indices can be specified as a range, two numbers separated by a dash. | |
74 | .PP | |
75 | \f2xfs_db\f1 maintains a current address in the filesystem. | |
76 | The granularity of the address is a filesystem structure. | |
77 | This can be a filesystem block, | |
78 | an inode or quota (smaller than a filesystem block), | |
79 | or a directory block (could be larger than a filesystem block). | |
80 | There are a variety of commands to set the current address. | |
81 | Associated with the current address is the current data type, | |
82 | which is the structural type of this data. | |
83 | Commands which follow the structure of the filesystem always set the type | |
84 | as well as the address. | |
85 | Commands which examine pieces of an individual file (inode) need the current | |
86 | inode to be set, this is done with the \f3inode\f1 command. | |
87 | .PP | |
88 | The current address/type information is actually maintained in a | |
89 | stack that can be explicitly manipulated with the | |
90 | \f3push\f1, \f3pop\f1, and \f3stack\f1 commands. | |
91 | This allows for easy examination of a nested filesystem structure. | |
92 | Also, the last several locations visited are stored in a ring buffer | |
93 | which can be manipulated with the | |
94 | \f3forward\f1, \f3back\f3, and \f3ring\f1 commands. | |
95 | .PP | |
96 | XFS filesystems are divided into a small number of allocation groups. | |
97 | \f2xfs_db\f1 maintains a notion of the current allocation group which is | |
98 | manipulated by some commands. | |
99 | The initial allocation group is 0. | |
100 | .SH COMMANDS | |
101 | .PP | |
102 | Many commands have extensive online help. | |
103 | Use the \f3help\f1 command for more details on any command. | |
104 | .TP 10 | |
105 | \f3a\f1 | |
106 | See the \f3addr\f1 command. | |
107 | .TP | |
108 | \f3ablock\f1 \f2filoff\f1 | |
109 | Set current address to the offset \f2filoff\f1 (a filesystem block number) | |
110 | in the attribute area of the current inode. | |
111 | .TP | |
112 | \f3addr\f1 [ \f2field-expression\f1 ] | |
113 | Set current address to the value of the \f2field-expression\f1. | |
114 | This is used to ``follow'' a reference in one structure to the object | |
115 | being referred to. | |
116 | If no argument is given the current address is printed. | |
117 | .TP | |
118 | \f3agf\f1 [ \f2agno\f1 ] | |
119 | Set current address to the AGF block for allocation group \f2agno\f1. | |
120 | If no argument is given use the current allocation group. | |
121 | .TP | |
122 | \f3agfl\f1 [ \f2agno\f1 ] | |
123 | Set current address to the AGFL block for allocation group \f2agno\f1. | |
124 | If no argument is given use the current allocation group. | |
125 | .TP | |
126 | \f3agi\f1 [ \f2agno\f1 ] | |
127 | Set current address to the AGI block for allocation group \f2agno\f1. | |
128 | If no argument is given use the current allocation group. | |
129 | .TP | |
130 | \f3b\f1 | |
131 | See the \f3back\f1 command. | |
132 | .TP | |
133 | \f3back\f1 | |
134 | Move to the previous location in the position ring. | |
135 | .TP | |
136 | \f3blockfree\f1 | |
137 | Free block usage information collected by the last execution of the | |
138 | \f3blockget\f1 command. | |
139 | This must be done before another \f3blockget\f1 command can be given, | |
140 | presumably with different arguments than the previous one. | |
141 | .TP | |
142 | \f3blockget\f1 [ \f3\-npsv\f1 ] [ \f3\-b\f1 \f2bno\f1 ] ... [ \f3\-i\f1 \f2ino\f1 ] ... | |
143 | Get block usage and check filesystem consistency. | |
144 | The information is saved for use by a subsequent | |
145 | \f3blockuse\f1, \f3ncheck\f1, or \f3blocktrash\f1 command. | |
146 | See \f2xfs_check\f1(8) for more information. | |
147 | .br | |
148 | The \f3\-b\f1 option is used to specify filesystem block numbers | |
149 | about which verbose information should be printed. | |
150 | .br | |
151 | The \f3\-i\f1 option is used to specify inode numbers about which | |
152 | verbose information should be printed. | |
153 | .br | |
154 | The \f3\-n\f1 option is used to save pathnames for inodes visited, | |
155 | this is used to support the \f2xfs_ncheck\f1(8) command. | |
156 | It also means that pathnames will be printed for inodes that have problems. | |
157 | This option uses a lot of memory so is not enabled by default. | |
158 | .br | |
159 | The \f3\-p\f1 option causes error messages to be prefixed with the | |
160 | filesystem name being processed. | |
161 | This is useful if several copies of \f2xfs_db\f1 are run in parallel. | |
162 | .br | |
163 | The \f3\-s\f1 option restricts output to severe errors only. | |
164 | This is useful if the output is too long otherwise. | |
165 | .br | |
166 | The \f3\-v\f1 option enables verbose output. | |
167 | Messages will be printed for every block and inode processed. | |
168 | .TP | |
169 | \f3blocktrash\f1 [ \f3\-n\f1 \f2c\f1 ] [ \f3\-x\f1 \f2a\f1 ] [ \f3\-y\f1 \f2b\f1 ] [ \f3\-s\f1 \f2s\f1 ] [ \f3\-0123\f1 ] [ \f3\-t\f1 \f2t\f1 ] ... | |
170 | Trash randomly selected filesystem metadata blocks. | |
171 | Trashing occurs to randomly selected bits in the chosen blocks. | |
172 | This command is available only in debugging versions of \f2xfs_db\f1. | |
173 | It is useful for testing \f2xfs_repair\f1(8) and \f2xfs_check\f1(8). | |
174 | .br | |
175 | The \f3\-0\f1, \f3\-1\f1, \f3\-2\f1, and \f3\-3\f1 options (mutually exclusive) | |
176 | set the operating mode for \f3blocktrash\f1. | |
177 | In \f3\-0\f1 mode, changed bits are cleared. | |
178 | In \f3\-1\f1 mode, changed bits are set. | |
179 | In \f3\-2\f1 mode, changed bits are inverted. | |
180 | In \f3\-3\f1 mode, changed bits are randomized. | |
181 | .br | |
182 | The \f3\-n\f1 option supplies the count of block-trashings to perform | |
183 | (default 1). | |
184 | .br | |
185 | The \f3\-s\f1 option supplies a seed to the random processing. | |
186 | .br | |
187 | The \f3\-t\f1 option gives a type of blocks to be selected | |
188 | for trashing. | |
189 | Multiple \f3\-t\f1 options may be given. | |
190 | If no \f3\-t\f1 options are given then all metadata types can be trashed. | |
191 | .br | |
192 | The \f3\-x\f1 option sets the minimum size of bit range to be trashed. | |
193 | The default value is 1. | |
194 | .br | |
195 | The \f3\-y\f1 option sets the maximum size of bit range to be trashed. | |
196 | The default value is 1024. | |
197 | .TP | |
198 | \f3blockuse\f1 [ \f3\-n\f1 ] [ \f3\-c\f1 \f2blockcount\f1 ] | |
199 | Print usage for current filesystem block(s). | |
200 | For each block, the type and (if any) inode are printed. | |
201 | .br | |
202 | The \f3\-c\f1 option specifies a count of blocks to process. | |
203 | The default value is 1 (the current block only). | |
204 | .br | |
205 | The \f3\-n\f1 option specifies that file names should be printed. | |
206 | The prior \f3blockget\f1 command must have also specified the \f3\-n\f1 option. | |
207 | .TP | |
208 | \f3bmap\f1 [ \f3\-a\f1 ] [ \f3\-d\f1 ] [ \f2block\f1 [ \f2len\f1 ] ] | |
209 | Show the block map for the current inode. | |
210 | The map display can be restricted to an area of the file with the | |
211 | \f2block\f1 and \f2len\f1 arguments. | |
212 | If \f2block\f1 is given and \f2len\f1 is omitted then 1 is assumed for len. | |
213 | .br | |
214 | The \f3\-a\f1 and \f3\-d\f1 options are used to select the attribute or data | |
215 | area of the inode, if neither option is given then both areas are shown. | |
216 | .TP | |
217 | \f3check\f1 | |
218 | See the \f3blockget\f1 command. | |
219 | .TP | |
220 | \f3convert\f1 \f2type\f1 \f2number\f1 [ \f2type\f1 \f2number\f1 ] ... \f2type\f1 | |
221 | Convert from one address form to another. | |
222 | The known \f2type\f1s, with alternate names, are: | |
223 | \f3agblock\f1 or \f3agbno\f1 (filesystem block within an allocation group), | |
224 | \f3agino\f1 or \f3aginode\f1 (inode number within an allocation group), | |
225 | \f3agnumber\f1 or \f3agno\f1 (allocation group number), | |
226 | \f3bboff\f1 or \f3daddroff\f1 (byte offset in a \f3daddr\f1), | |
227 | \f3blkoff\f1 or \f3fsboff\f1 or \f3agboff\f1 (byte offset in a \f3agblock\f1 | |
228 | or \f3fsblock\f1), | |
229 | \f3byte\f1 or \f3fsbyte\f1 (byte address in filesystem), | |
230 | \f3daddr\f1 or \f3bb\f1 (disk address, 512-byte blocks), | |
231 | \f3fsblock\f1 or \f3fsb\f1 or \f3fsbno\f1 (filesystem block, see the | |
232 | \f3fsblock\f1 command), | |
233 | \f3ino\f1 or \f3inode\f1 (inode number), | |
234 | \f3inoidx\f1 or \f3offset\f1 (index of inode in filesystem block), | |
235 | and \f3inooff\f1 or \f3inodeoff\f1 (byte offset in inode). | |
236 | Only conversions that ``make sense'' are allowed. | |
237 | The compound form (with more than three arguments) is useful for | |
238 | conversions such as | |
239 | \f3convert\f1 \f3agno\f1 \f2ag\f1 \f3agbno\f1 \f2agb\f1 \f3fsblock\f1. | |
240 | .TP | |
241 | \f3daddr\f1 [ \f2d\f1 ] | |
242 | Set current address to the daddr (512 byte block) given by \f2d\f1. | |
243 | If no value for \f2d\f1 is given the current address is printed, | |
244 | expressed as a daddr. | |
245 | The type is set to \f3data\f1 (uninterpreted). | |
246 | .TP | |
247 | \f3dblock\f1 \f2filoff\f1 | |
248 | Set current address to the offset \f2filoff\f1 (a filesystem block number) | |
249 | in the data area of the current inode. | |
250 | .TP | |
251 | \f3debug\f1 [ \f2flagbits\f1 ] | |
252 | Set debug option bits. | |
253 | These are used for debugging \f2xfs_db\f1. | |
254 | If no value is given for \f2flagbits\f1, print the current debug option bits. | |
255 | These are for the use of the implementor. | |
256 | .TP | |
257 | \f3dquot\f1 [ \f2projectid_or_userid\f1 ] | |
258 | Set current address to a project or user quota block. | |
259 | .TP | |
260 | \f3echo\f1 [ \f2arg\f1 ] ... | |
261 | Echo the arguments to the output. | |
262 | .TP | |
263 | \f3f\f1 | |
264 | See the \f3forward\f1 command. | |
265 | .TP | |
266 | \f3forward\f1 | |
267 | Move forward to the next entry in the position ring. | |
268 | .TP | |
269 | \f3frag\f1 [ \f3\-adflqRrv\f1 ] | |
270 | Get file fragmentation data. | |
271 | This prints information about fragmentation of file data in the filesystem | |
272 | (as opposed to fragmentation of freespace, | |
273 | for which see the \f3freesp\f1 command). | |
274 | Every file in the filesystem is examined to see how far from ideal | |
275 | its extent mappings are. | |
276 | A summary is printed giving the totals. | |
277 | .br | |
278 | The \f3\-v\f1 option sets verbosity, | |
279 | every inode has information printed for it. | |
280 | The remaining options select which inodes and extents are examined. | |
281 | If no options are given then all are assumed set, | |
282 | otherwise just those given are enabled. | |
283 | .br | |
284 | The \f3\-a\f1 option enables processing of attribute data. | |
285 | .br | |
286 | The \f3\-d\f1 option enables processing of directory data. | |
287 | .br | |
288 | The \f3\-f\f1 option enables processing of regular file data. | |
289 | .br | |
290 | The \f3\-l\f1 option enables processing of symbolic link data. | |
291 | .br | |
292 | The \f3\-q\f1 option enables processing of quota file data. | |
293 | .br | |
294 | The \f3\-R\f1 option enables processing of realtime control file data. | |
295 | .br | |
296 | The \f3\-r\f1 option enables processing of realtime file data. | |
297 | .TP | |
298 | \f3freesp\f1 [ \f3\-bcds\f1 ] [ \f3\-a\f1 \f2a\f1 ] ... [ \f3\-e\f1 \f2i\f1 ] [ \f3\-h\f1 \f2h1\f1 ] ... [ \f3\-m\f1 \f2m\f1 ] | |
299 | Summarize free space for the filesystem. | |
300 | The free blocks are examined and totalled, | |
301 | and displayed in the form of a histogram, | |
302 | with a count of extents in each range of free extent sizes. | |
303 | .br | |
304 | The \f3\-a\f1 \f2a\f1 option adds \f2a\f1 to the list of | |
305 | allocation groups to be processed. | |
306 | If no \f3\-a\f1 options are given then all allocation groups are processed. | |
307 | .br | |
308 | The \f3\-b\f1 option specifies that the histogram buckets are binary-sized, | |
309 | with the starting sizes being the powers of 2. | |
310 | .br | |
311 | The \f3\-c\f1 option specifies that \f3freesp\f1 will search the | |
312 | by-size (cnt) space Btree instead of the default by-block (bno) space Btree. | |
313 | .br | |
314 | The \f3\-d\f1 option specifies that every free extent will be displayed. | |
315 | .br | |
316 | The \f3\-e\f1 \f2i\f1 option specifies that the histogram buckets are | |
317 | equal-sized, with the size specified as \f2i\f1. | |
318 | .br | |
319 | The \f3\-h\f1 \f2h1\f1 option specifies a starting block number | |
320 | for a histogram bucket as \f2h1\f1. | |
321 | Multiple \f3\-h\f1 options are given to specify the complete set of buckets. | |
322 | .br | |
323 | The \f3\-m\f1 \f2m\f1 option specifies that the histogram | |
324 | starting block numbers are powers of \f2m\f1. | |
325 | This is the general case of \f3\-b\f1. | |
326 | .br | |
327 | The \f3\-s\f1 option specifies that a final summary of total free extents, | |
328 | free blocks, and the average free extent size is printed. | |
329 | .TP | |
330 | \f3fsb\f1 | |
331 | See the \f3fsblock\f1 command. | |
332 | .TP | |
333 | \f3fsblock\f1 [ \f2fsb\f1 ] | |
334 | Set current address to the fsblock value given by \f2fsb\f1. | |
335 | If no value for \f2fsb\f1 is given the current address is printed, | |
336 | expressed as an fsb. | |
337 | The type is set to \f3data\f1 (uninterpreted). | |
338 | XFS filesystem block numbers are computed | |
339 | ((\f2agno\f1 << \f2agshift\f1) | \f2agblock\f1) | |
340 | where \f2agshift\f1 depends on the size of an allocation group. | |
341 | Use the \f3convert\f1 command to convert to and from this form. | |
342 | Block numbers given for file blocks | |
343 | (for instance from the \f3bmap\f1 command) | |
344 | are in this form. | |
345 | .TP | |
346 | \f3hash\f1 \f2string\f1 | |
347 | Prints the hash value of \f2string\f1 using the hash function of the XFS | |
348 | directory and attribute implementation. | |
349 | .TP | |
350 | \f3help\f1 [ \f2command\f1 ] | |
351 | Print help for one or all commands. | |
352 | .TP | |
353 | \f3inode\f1 [ \f2inode#\f1 ] | |
354 | Set the current inode number. | |
355 | If no \f2inode#\f1 is given, print the current inode number. | |
356 | .TP | |
512cfb8a NS |
357 | \f3label\f1 [ \f2label\f1 ] |
358 | Set the filesystem label. | |
359 | The filesystem label can be used by | |
360 | .IR mount (8) | |
361 | instead of using a device special file. | |
362 | The maximum length of an XFS label is 12 characters \- use of a longer | |
363 | \f2label\f1 will result in truncation and a warning will be issued. | |
364 | If no \f2label\f1 is given, the current filesystem label is printed. | |
365 | .TP | |
2bd0ea18 NS |
366 | \f3log\f1 [ \f3stop\f1 | \f3start\f1 \f2filename\f1 ] |
367 | Start logging output to \f2filename\f1, stop logging, | |
368 | or print the current logging status. | |
369 | .TP | |
370 | \f3ncheck\f1 [ \f3\-s\f1 ] [ \f3\-i\f1 \f2ino\f1 ] ... | |
371 | Print name-inode pairs. | |
4ebc222c | 372 | A \f3blockget \-n\f1 command must be run first to gather the information. |
2bd0ea18 NS |
373 | .br |
374 | The \f3\-i\f1 option specifies an inode number to be printed. | |
375 | If no \f3\-i\f1 options are given then all inodes are printed. | |
376 | .br | |
377 | The \f3\-s\f1 option specifies that only setuid and setgid files are printed. | |
378 | .TP | |
379 | \f3p\f1 | |
380 | See the \f3print\f1 command. | |
381 | .TP | |
382 | \f3pop\f1 | |
383 | Pop location from the stack. | |
384 | .TP | |
385 | \f3print\f1 [ \f2field-expression\f1 ] ... | |
386 | Print field values. | |
387 | If no argument is given, print all fields in the current structure. | |
388 | .TP | |
389 | \f3push\f1 [ \f2command\f1 ] | |
390 | Push location to the stack. | |
391 | If \f2command\f1 is supplied, | |
392 | set the current location to the results of \f2command\f1 | |
393 | after pushing the old location. | |
394 | .TP | |
395 | \f3q\f1 | |
396 | See the \f3quit\f1 command. | |
397 | .TP | |
398 | \f3quit\f1 | |
399 | Exit \f2xfs_db\f1. | |
400 | .TP | |
401 | \f3ring\f1 [ \f2index\f1 ] | |
402 | Show position ring (if no \f2index\f1 argument is given), | |
403 | or move to a specific entry in the position ring given by \f2index\f1. | |
404 | .TP | |
405 | \f3sb\f1 [ \f2agno\f1 ] | |
406 | Set current address to SB header in allocation group \f2agno\f1. | |
407 | If no \f2agno\f1 is given use the current allocation group number. | |
408 | .TP | |
409 | \f3source\f1 \f2source-file\f1 | |
410 | Process commands from \f2source-file\f1. | |
411 | \f3source\f1 commands can be nested. | |
412 | .TP | |
413 | \f3stack\f1 | |
414 | View the location stack. | |
415 | .TP | |
416 | \f3type\f1 [ \f2type\f1 ] | |
417 | Set the current data type to \f2type\f1. | |
418 | If no argument is given, show the current data type. | |
419 | The possible data types are: | |
420 | \f3agf\f1, \f3agfl\f1, \f3agi\f1, \f3attr\f1, \f3bmapbta\f1, \f3bmapbtd\f1, | |
421 | \f3bnobt\f1, \f3cntbt\f1, \f3data\f1, \f3dir\f1, \f3dir2\f1, \f3dqblk\f1, | |
422 | \f3inobt\f1, \f3inode\f1, \f3log\f1, \f3rtbitmap\f1, \f3rtsummary\f1, | |
c6b24b3b | 423 | \f3sb\f1, \f3symlink\f1, and \f3text\f1. |
2bd0ea18 NS |
424 | See the TYPES section below for more information on these data types. |
425 | .TP | |
512cfb8a NS |
426 | \f3uuid\f1 [ \f2uuid\f1 or \f2generate\f1 or \f2rewrite\f1 ] |
427 | Set the filesystem universally unique identifier (UUID). | |
428 | The filesystem UUID can be used by | |
429 | .IR mount (8) | |
430 | instead of using a device special file. | |
431 | The \f2uuid\f1 can be set directly to the desired UUID, or it can | |
432 | be automatically generated using the \f2generate\f1 option. | |
433 | These options will both write the UUID into every copy of the | |
434 | superblock in the filesystem. | |
435 | \f2rewrite\f1 copies the current UUID from the primary superblock | |
436 | to all secondary copies of the superblock. | |
437 | If no argument is given, the current filesystem UUID is printed. | |
438 | .TP | |
d2df702b | 439 | \f3version\f1 [ \f2extflg\f1 | [\f2versionnum\f1 \f2features2\f1 ] ] |
4ca431fc NS |
440 | Enable selected features for a filesystem (certain features can |
441 | be enabled on an unmounted filesystem, after | |
442 | .IR mkfs.xfs (8) | |
443 | has created the filesystem). | |
444 | Support for unwritten extents can be enabled using the \f2extflg\f1 | |
445 | option. | |
d2df702b NS |
446 | Support for extended attributes can be enabled using the \f2attr1\f1 |
447 | or \f2attr2\f1 option. | |
448 | Once enabled, extended attributes cannot be disabled, but the user | |
449 | may toggle between \f2attr1\f1 and \f2attr2\f1 at will (older kernels | |
450 | may not support the newer version). | |
451 | .br | |
452 | With one argument, this command will write the updated version number | |
453 | into every copy of the superblock in the filesystem. | |
4ca431fc | 454 | If no argument is given, the current version and feature bits are printed. |
d2df702b NS |
455 | If two arguments are given, they will be used as numeric values for the |
456 | \f2versionnum\f1 and \f2features2\f1 bits respectively, and their string | |
457 | equivalent reported (but no modifications are made). | |
4ca431fc | 458 | .TP |
512cfb8a | 459 | \f3write\f1 [ \f2field\f1 or \f2value\f1 ] ... |
2bd0ea18 NS |
460 | Write a value to disk. |
461 | Specific fields can be set in structures (struct mode), | |
462 | or a block can be set to data values (data mode), | |
463 | or a block can be set to string values (string mode, for symlink blocks). | |
464 | The operation happens immediately: there is no buffering. | |
465 | .br | |
466 | Struct mode is in effect when the current type is structural, | |
467 | i.e. not data. | |
468 | For struct mode, the syntax is ``\f3write\f1 \f2field\f1 \f2value\f1''. | |
469 | .br | |
470 | Data mode is in effect when the current type is data. | |
471 | In this case the contents of the block can be shifted or rotated left or right, | |
472 | or filled with a sequence, a constant value, or a random value. | |
473 | In this mode \f3write\f1 with no arguments gives more information on | |
474 | the allowed commands. | |
475 | .SH TYPES | |
476 | This section gives the fields in each structure type and their meanings. | |
477 | Note that some types of block cover multiple actual structures, | |
478 | for instance directory blocks. | |
479 | .TP 10 | |
480 | \f3agf\f1 | |
481 | The AGF block is the header for block allocation information; | |
482 | it is in the second 512-byte block of each allocation group. | |
483 | The following fields are defined: | |
484 | .br | |
485 | \f3magicnum\f1: AGF block magic number, 0x58414746 ('XAGF') | |
486 | .br | |
487 | \f3versionnum\f1: version number, currently 1 | |
488 | .br | |
489 | \f3seqno\f1: sequence number starting from 0 | |
490 | .br | |
491 | \f3length\f1: size in filesystem blocks of the allocation group. | |
492 | All allocation groups except the last one of the filesystem have | |
493 | the superblock's \f3agblocks\f1 value here | |
494 | .br | |
495 | \f3bnoroot\f1: block number of the root of the Btree holding free space | |
496 | information sorted by block number | |
497 | .br | |
498 | \f3cntroot\f1: block number of the root of the Btree holding free space | |
499 | information sorted by block count | |
500 | .br | |
501 | \f3bnolevel\f1: number of levels in the by-block-number Btree | |
502 | .br | |
503 | \f3cntlevel\f1: number of levels in the by-block-count Btree | |
504 | .br | |
505 | \f3flfirst\f1: index into the AGFL block of the first active entry | |
506 | .br | |
507 | \f3fllast\f1: index into the AGFL block of the last active entry | |
508 | .br | |
509 | \f3flcount\f1: count of active entries in the AGFL block | |
510 | .br | |
511 | \f3freeblks\f1: count of blocks represented in the freespace Btrees | |
512 | .br | |
513 | \f3longest\f1: longest free space represented in the freespace Btrees | |
514 | .TP | |
515 | \f3agfl\f1 | |
516 | The AGFL block contains block numbers for use of the block allocator; | |
517 | it is in the fourth 512-byte block of each allocation group. | |
518 | Each entry in the active list is a block number within the allocation group | |
519 | that can be used for any purpose if space runs low. | |
520 | The AGF block fields \f3flfirst\f1, \f3fllast\f1, and \f3flcount\f1 | |
521 | designate which entries are currently active. | |
522 | Entry space is allocated in a circular manner within the AGFL block. | |
523 | Fields defined: | |
524 | .br | |
525 | \f3bno\f1: array of all block numbers. | |
526 | Even those which are not active are printed | |
527 | .TP | |
528 | \f3agi\f1 | |
529 | The AGI block is the header for inode allocation information; | |
530 | it is in the third 512-byte block of each allocation group. | |
531 | Fields defined: | |
532 | .br | |
533 | \f3magicnum\f1: AGI block magic number, 0x58414749 ('XAGI') | |
534 | .br | |
535 | \f3versionnum\f1: version number, currently 1 | |
536 | .br | |
537 | \f3seqno\f1: sequence number starting from 0 | |
538 | .br | |
539 | \f3length\f1: size in filesystem blocks of the allocation group | |
540 | .br | |
541 | \f3count\f1: count of inodes allocated | |
542 | .br | |
543 | \f3root\f1: block number of the root of the Btree holding inode allocation | |
544 | information | |
545 | .br | |
546 | \f3level\f1: number of levels in the inode allocation Btree | |
547 | .br | |
548 | \f3freecount\f1: count of allocated inodes that are not in use | |
549 | .br | |
550 | \f3newino\f1: last inode number allocated | |
551 | .br | |
552 | \f3dirino\f1: unused | |
553 | .br | |
554 | \f3unlinked\f1: an array of inode numbers within the allocation group. | |
555 | The entries in the AGI block are the heads of lists which run through the | |
556 | inode \f3next_unlinked\f1 field. | |
557 | These inodes are to be unlinked the next time the filesystem is mounted | |
558 | .TP | |
559 | \f3attr\f1 | |
560 | An attribute fork is organized as a Btree with the actual data | |
561 | embedded in the leaf blocks. | |
562 | The root of the Btree is found in block 0 of the fork. | |
563 | The index (sort order) of the Btree is the hash value of the attribute name. | |
564 | All the blocks contain a \f3blkinfo\f1 structure at the beginning, | |
565 | see type \f3dir\f1 for a description. | |
566 | Nonleaf blocks are identical in format to those for version 1 and | |
567 | version 2 directories, see type \f3dir\f1 for a description. | |
568 | Leaf blocks can refer to ``local'' or ``remote'' attribute values. | |
569 | Local values are stored directly in the leaf block. | |
570 | Remote values are stored in an independent block in the attribute fork | |
571 | (with no structure). | |
572 | Leaf blocks contain the following fields: | |
573 | .br | |
574 | \f3hdr\f1: header containing | |
575 | a \f3blkinfo\f1 structure \f3info\f1 (magic number 0xfbee), | |
576 | a \f3count\f1 of active entries, | |
577 | \f3usedbytes\f1 total bytes of names and values, | |
578 | the \f3firstused\f1 byte in the name area, | |
579 | \f3holes\f1 set if the block needs compaction, | |
580 | and array \f3freemap\f1 as for \f3dir\f1 leaf blocks | |
581 | .br | |
582 | \f3entries\f1: array of structures containing | |
583 | a \f3hashval\f1, | |
584 | \f3nameidx\f1 (index into the block of the name), | |
585 | and flags \f3incomplete\f1, | |
586 | \f3root\f1, | |
587 | and \f3local\f1 | |
588 | .br | |
589 | \f3nvlist\f1: array of structures describing the attribute names and values. | |
590 | Fields always present: | |
591 | \f3valuelen\f1 (length of value in bytes), | |
592 | \f3namelen\f1, | |
593 | and \f3name\f1. | |
594 | Fields present for local values: | |
595 | \f3value\f1 (value string). | |
596 | Fields present for remote values: | |
597 | \f3valueblk\f1 (fork block number of containing the value). | |
598 | .TP | |
599 | \f3bmapbt\f1 | |
600 | Files with many extents in their data or attribute fork will have the | |
601 | extents described by the contents of a Btree for that fork, | |
602 | instead of being stored directly in the inode. | |
603 | Each bmap Btree starts with a root block contained within the inode. | |
604 | The other levels of the Btree are stored in filesystem blocks. | |
605 | The blocks are linked to sibling left and right blocks at each level, | |
606 | as well as by pointers from parent to child blocks. | |
607 | Each block contains the following fields: | |
608 | .br | |
609 | \f3magic\f1: bmap Btree block magic number, 0x424d4150 ('BMAP') | |
610 | .br | |
611 | \f3level\f1: level of this block above the leaf level | |
612 | .br | |
613 | \f3numrecs\f1: number of records or keys in the block | |
614 | .br | |
615 | \f3leftsib\f1: left (logically lower) sibling block, 0 if none | |
616 | .br | |
617 | \f3rightsib\f1: right (logically higher) sibling block, 0 if none | |
618 | .br | |
619 | \f3recs\f1: [leaf blocks only] array of extent records. | |
620 | Each record contains | |
621 | \f3startoff\f1, | |
622 | \f3startblock\f1, | |
623 | \f3blockcount\f1, | |
624 | and \f3extentflag\f1 (1 if the extent is unwritten) | |
625 | .br | |
626 | \f3keys\f1: [nonleaf blocks only] array of key records. | |
627 | These are the first key value of each block in the level below this one. | |
628 | Each record contains \f3startoff\f1 | |
629 | .br | |
630 | \f3ptrs\f1: [nonleaf blocks only] array of child block pointers. | |
631 | Each pointer is a filesystem block number to the next level in the Btree | |
632 | .TP | |
633 | \f3bnobt\f1 | |
634 | There is one set of filesystem blocks forming the by-block-number allocation | |
635 | Btree for each allocation group. | |
636 | The root block of this Btree is designated by the \f3bnoroot\f1 field in the | |
637 | coresponding AGF block. | |
638 | The blocks are linked to sibling left and right blocks at each level, | |
639 | as well as by pointers from parent to child blocks. | |
640 | Each block has the following fields: | |
641 | .br | |
642 | \f3magic\f1: BNOBT block magic number, 0x41425442 ('ABTB') | |
643 | .br | |
644 | \f3level\f1: level number of this block, 0 is a leaf | |
645 | .br | |
646 | \f3numrecs\f1: number of data entries in the block | |
647 | .br | |
648 | \f3leftsib\f1: left (logically lower) sibling block, 0 if none | |
649 | .br | |
650 | \f3rightsib\f1: right (logically higher) sibling block, 0 if none | |
651 | .br | |
652 | \f3recs\f1: [leaf blocks only] array of freespace records. | |
653 | Each record contains | |
654 | \f3startblock\f1 | |
655 | and \f3blockcount\f1 | |
656 | .br | |
657 | \f3keys\f1: [nonleaf blocks only] array of key records. | |
658 | These are the first value of each block in the level below this one. | |
d2df702b | 659 | Each record contains |
2bd0ea18 NS |
660 | \f3startblock\f1 |
661 | and \f3blockcount\f1 | |
662 | .br | |
663 | \f3ptrs\f1: [nonleaf blocks only] array of child block pointers. | |
664 | Each pointer is a block number within the allocation group to the next level | |
665 | in the Btree | |
666 | .TP | |
667 | \f3cntbt\f1 | |
668 | There is one set of filesystem blocks forming the by-block-count allocation | |
669 | Btree for each allocation group. | |
670 | The root block of this Btree is designated by the \cntroot\f1 field in the | |
671 | coresponding AGF block. | |
672 | The blocks are linked to sibling left and right blocks at each level, | |
673 | as well as by pointers from parent to child blocks. | |
674 | Each block has the following fields: | |
675 | .br | |
676 | \f3magic\f1: CNTBT block magic number, 0x41425443 ('ABTC') | |
677 | .br | |
678 | \f3level\f1: level number of this block, 0 is a leaf | |
679 | .br | |
680 | \f3numrecs\f1: number of data entries in the block | |
681 | .br | |
682 | \f3leftsib\f1: left (logically lower) sibling block, 0 if none | |
683 | .br | |
684 | \f3rightsib\f1: right (logically higher) sibling block, 0 if none | |
685 | .br | |
686 | \f3recs\f1: [leaf blocks only] array of freespace records. | |
d2df702b | 687 | Each record contains |
2bd0ea18 NS |
688 | \f3startblock\f1 |
689 | and \f3blockcount\f1 | |
690 | .br | |
691 | \f3keys\f1: [nonleaf blocks only] array of key records. | |
692 | These are the first value of each block in the level below this one. | |
d2df702b | 693 | Each record contains |
2bd0ea18 NS |
694 | \f3blockcount\f1 |
695 | and \f3startblock\f1 | |
696 | .br | |
697 | \f3ptrs\f1: [nonleaf blocks only] array of child block pointers. | |
698 | Each pointer is a block number within the allocation group to the next level | |
699 | in the Btree | |
700 | .TP | |
701 | \f3data\f1 | |
702 | User file blocks, and other blocks whose type is unknown, | |
703 | have this type for display purposes in \f2xfs_db\f1. | |
704 | The block data is displayed in hexadecimal format. | |
705 | .TP | |
706 | \f3dir\f1 | |
707 | A version 1 directory is organized as a Btree with the directory data | |
708 | embedded in the leaf blocks. | |
709 | The root of the Btree is found in block 0 of the file. | |
710 | The index (sort order) of the Btree is the hash value of the entry name. | |
711 | All the blocks contain a \f3blkinfo\f1 structure at the beginning | |
712 | with the following fields: | |
713 | .br | |
714 | \f3forw\f1: next sibling block | |
715 | .br | |
716 | \f3back\f1: previous sibling block | |
717 | .br | |
718 | \f3magic\f1: magic number for this block type | |
719 | .sp | |
720 | The nonleaf (node) blocks have the following fields: | |
721 | .br | |
722 | \f3hdr\f1: header containing | |
723 | a \f3blkinfo\f1 structure \f3info\f1 (magic number 0xfebe), | |
724 | the \f3count\f1 of active entries, | |
725 | and the \f3level\f1 of this block above the leaves | |
726 | .br | |
727 | \f3btree\f1: array of entries containing | |
728 | \f3hashval\f1 and | |
729 | \f3before\f1 fields. | |
730 | The \f3before\f1 value is a block number within the directory file to the | |
731 | child block, | |
732 | the \f3hashval\f1 is the last hash value in that block | |
733 | .sp | |
734 | The leaf blocks have the following fields: | |
735 | .br | |
736 | \f3hdr\f1: header containing | |
737 | a \f3blkinfo\f1 structure \f3info\f1 (magic number 0xfeeb), | |
738 | the \f3count\f1 of active entries, | |
739 | \f3namebytes\f1 (total name string bytes), | |
740 | \f3holes\f1 flag (block needs compaction), | |
741 | and \f3freemap\f1 (array of \f3base\f1, \f3size\f1 entries for free regions) | |
742 | .br | |
743 | \f3entries\f1: array of structures containing | |
744 | \f3hashval\f1, | |
745 | \f3nameidx\f1 (byte index into the block of the name string), | |
746 | and \f3namelen\f1 | |
747 | .br | |
748 | \f3namelist\f1: array of structures containing | |
749 | \f3inumber\f1 | |
750 | and \f3name\f1 | |
751 | .TP | |
752 | \f3dir2\f1 | |
753 | A version 2 directory has four kinds of blocks. | |
754 | Data blocks start at offset 0 in the file. | |
755 | There are two kinds of data blocks: single-block directories have | |
756 | the leaf information embedded at the end of the block, data blocks | |
757 | in multi-block directories do not. | |
062998e3 | 758 | Node and leaf blocks start at offset 32GiB (with either a single |
2bd0ea18 | 759 | leaf block or the root node block). |
062998e3 | 760 | Freespace blocks start at offset 64GiB. |
2bd0ea18 NS |
761 | The node and leaf blocks form a Btree, with references to the data |
762 | in the data blocks. | |
763 | The freespace blocks form an index of longest free spaces within the | |
764 | data blocks. | |
765 | .sp | |
766 | A single-block directory block contains the following fields: | |
767 | .br | |
d2df702b | 768 | \f3bhdr\f1: header containing |
2bd0ea18 NS |
769 | \f3magic\f1 number 0x58443242 ('XD2B') |
770 | and an array \f3bestfree\f1 of the longest 3 free spaces in the block | |
771 | (\f3offset\f1, \f3length\f1) | |
772 | .br | |
773 | \f3bu\f1: array of union structures. | |
774 | Each element is either an entry or a freespace. | |
775 | For entries, there are the following fields: | |
776 | \f3inumber\f1, | |
777 | \f3namelen\f1, | |
778 | \f3name\f1, | |
779 | and \f3tag\f1. | |
780 | For freespace, there are the following fields: | |
781 | \f3freetag\f1 (0xffff), | |
782 | \f3length\f1, | |
783 | and \f3tag\f1. | |
784 | The \f3tag\f1 value is the byte offset in the block of the start | |
785 | of the entry it is contained in | |
786 | .br | |
787 | \f3bleaf\f1: array of leaf entries containing | |
788 | \f3hashval\f1 | |
789 | and \f3address\f1. | |
790 | The \f3address\f1 is a 64-bit word offset into the file | |
791 | .br | |
792 | \f3btail\f1: tail structure containing | |
793 | the total \f3count\f1 of leaf entries | |
794 | and \f3stale\f1 count of unused leaf entries | |
795 | .sp | |
796 | A data block contains the following fields: | |
797 | .br | |
798 | \f3dhdr\f1: | |
d2df702b | 799 | header containing |
2bd0ea18 NS |
800 | \f3magic\f1 number 0x58443244 ('XD2D') |
801 | and an array \f3bestfree\f1 of the longest 3 free spaces in the block | |
802 | (\f3offset\f1, \f3length\f1) | |
803 | .br | |
804 | \f3du\f1: array of union structures as for \f3bu\f1 | |
805 | .sp | |
806 | Leaf blocks have two possible forms. | |
807 | If the Btree consists of a single leaf then the freespace information | |
808 | is in the leaf block, | |
809 | otherwise it is in separate blocks and the root of the Btree is | |
810 | a node block. | |
811 | A leaf block contains the following fields: | |
812 | .br | |
813 | \f3lhdr\f1: header containing | |
814 | a \f3blkinfo\f1 structure \f3info\f1 (magic number 0xd2f1 for the single | |
815 | leaf case, 0xd2ff for the true Btree case), | |
816 | the total \f3count\f1 of leaf entries, | |
817 | and \f3stale\f1 count of unused leaf entries | |
818 | .br | |
819 | \f3lents\f1: leaf entries, as for \f3bleaf\f1 | |
820 | .br | |
821 | \f3lbests\f1: [single leaf only] | |
822 | array of values which represent the longest freespace | |
823 | in each data block in the directory | |
824 | .br | |
825 | \f3ltail\f1: [single leaf only] tail structure containing | |
826 | \f3bestcount\f1 count of \f3lbests\f1 | |
827 | .sp | |
828 | A node block is identical to that for types \f3attr\f1 and \f3dir\f1. | |
829 | .sp | |
830 | A freespace block contains the following fields: | |
831 | .br | |
832 | \f3fhdr\f1: header containing | |
d2df702b | 833 | \f3magic\f1 number 0x58443246 ('XD2F'), |
2bd0ea18 NS |
834 | \f3firstdb\f1 first data block number covered by this freespace block, |
835 | \f3nvalid\f1 number of valid entries, | |
836 | and \f3nused\f1 number of entries representing real data blocks | |
837 | .br | |
838 | \f3fbests\f1: array of values as for \f3lbests\f1 | |
839 | .TP | |
840 | \f3dqblk\f1 | |
841 | The quota information is stored in files referred to by the superblock | |
842 | \f3uquotino\f1 and \f3pquotino\f1 fields. | |
843 | Each filesystem block in a quota file contains a constant number of | |
844 | quota entries. | |
845 | The quota entry size is currently 136 bytes, | |
062998e3 | 846 | so with a 4KiB filesystem block size there are 30 quota entries per block. |
2bd0ea18 NS |
847 | The \f3dquot\f1 command is used to locate these entries in the filesystem. |
848 | The file entries are indexed by the user or project identifier | |
849 | to determine the block and offset. | |
850 | Each quota entry has the following fields: | |
851 | .br | |
852 | \f3magic\f1: magic number, 0x4451 ('DQ') | |
853 | .br | |
854 | \f3version\f1: version number, currently 1 | |
855 | .br | |
856 | \f3flags\f1: flags, values include | |
857 | 0x01 for user quota, | |
858 | 0x02 for project quota | |
859 | .br | |
860 | \f3id\f1: user or project identifier | |
861 | .br | |
862 | \f3blk_hardlimit\f1: absolute limit on blocks in use | |
863 | .br | |
864 | \f3blk_softlimit\f1: preferred limit on blocks in use | |
865 | .br | |
866 | \f3ino_hardlimit\f1: absolute limit on inodes in use | |
867 | .br | |
868 | \f3ino_softlimit\f1: preferred limit on inodes in use | |
869 | .br | |
870 | \f3bcount\f1: blocks actually in use | |
871 | .br | |
872 | \f3icount\f1: inodes actually in use | |
873 | .br | |
874 | \f3itimer\f1: time when service will be refused if soft limit is violated | |
875 | for inodes | |
876 | .br | |
877 | \f3btimer\f1: time when service will be refused if soft limit is violated | |
878 | for blocks | |
879 | .br | |
880 | \f3iwarns\f1: number of warnings issued about inode limit violations | |
881 | .br | |
882 | \f3bwarns\f1: number of warnings issued about block limit violations | |
883 | .br | |
884 | \f3rtb_hardlimit\f1: absolute limit on realtime blocks in use | |
885 | .br | |
886 | \f3rtb_softlimit\f1: preferred limit on realtime blocks in use | |
887 | .br | |
888 | \f3rtbcount\f1: realtime blocks actually in use | |
889 | .br | |
890 | \f3rtbtimer\f1: time when service will be refused if soft limit is violated | |
891 | for realtime blocks | |
892 | .br | |
893 | \f3rtbwarns\f1: number of warnings issued about realtime block limit violations | |
894 | .TP | |
895 | \f3inobt\f1 | |
896 | There is one set of filesystem blocks forming the inode allocation | |
897 | Btree for each allocation group. | |
898 | The root block of this Btree is designated by the \f3root\f1 field in the | |
899 | coresponding AGI block. | |
900 | The blocks are linked to sibling left and right blocks at each level, | |
901 | as well as by pointers from parent to child blocks. | |
902 | Each block has the following fields: | |
903 | .br | |
904 | \f3magic\f1: INOBT block magic number, 0x49414254 ('IABT') | |
905 | .br | |
906 | \f3level\f1: level number of this block, 0 is a leaf | |
907 | .br | |
908 | \f3numrecs\f1: number of data entries in the block | |
909 | .br | |
910 | \f3leftsib\f1: left (logically lower) sibling block, 0 if none | |
911 | .br | |
912 | \f3rightsib\f1: right (logically higher) sibling block, 0 if none | |
913 | .br | |
914 | \f3recs\f1: [leaf blocks only] array of inode records. | |
d2df702b | 915 | Each record contains |
2bd0ea18 NS |
916 | \f3startino\f1 allocation-group relative inode number, |
917 | \f3freecount\f1 count of free inodes in this chunk, | |
918 | and \f3free\f1 bitmap, LSB corresponds to inode 0 | |
919 | .br | |
920 | \f3keys\f1: [nonleaf blocks only] array of key records. | |
921 | These are the first value of each block in the level below this one. | |
d2df702b | 922 | Each record contains |
2bd0ea18 NS |
923 | \f3startino\f1 |
924 | .br | |
925 | \f3ptrs\f1: [nonleaf blocks only] array of child block pointers. | |
926 | Each pointer is a block number within the allocation group to the next level | |
927 | in the Btree | |
928 | .TP | |
929 | \f3inode\f1 | |
930 | Inodes are allocated in ``chunks'' of 64 inodes each. | |
931 | Usually a chunk is multiple filesystem blocks, although there are cases | |
932 | with large filesystem blocks where a chunk is less than one block. | |
933 | The inode Btree (see \f3inobt\f1 above) | |
934 | refers to the inode numbers per allocation group. | |
935 | The inode numbers directly reflect the location of the inode block on disk. | |
936 | Use the \f3inode\f1 command to point \f2xfs_db\f1 to a specific inode. | |
937 | Each inode contains four regions: | |
938 | \f3core\f1, | |
939 | \f3next_unlinked\f1, | |
940 | \f3u\f1, | |
941 | and \f3a\f1. | |
942 | \f3core\f1 contains the fixed information. | |
943 | \f3next_unlinked\f1 is separated from the core due to | |
c4510382 | 944 | journaling considerations, see type \f3agi\f1 field \f3unlinked\f1. |
2bd0ea18 NS |
945 | \f3u\f1 is a union structure that is different in size and format depending |
946 | on the type and representation of the file data (``data fork''). | |
947 | \f3a\f1 is an optional union structure to describe attribute data, | |
948 | that is different in size, format, and location depending on the presence | |
949 | and representation of attribute data, and the size of the \f3u\f1 data | |
950 | (``attribute fork''). | |
951 | \f2xfs_db\f1 automatically selects the proper union members based on | |
952 | information in the inode. | |
953 | .br | |
954 | The following are fields in the inode core: | |
955 | .br | |
956 | \f3magic\f1: inode magic number, 0x494e ('IN') | |
957 | .br | |
958 | \f3mode\f1: mode and type of file, as described in \f3chmod\f1(2), | |
959 | \f3mknod\f1(2), and \f3stat\f1(2) | |
960 | .br | |
961 | \f3version\f1: inode version, 1 or 2 | |
962 | .br | |
963 | \f3format\f1: format of \f3u\f1 union data | |
63899e27 | 964 | (0: xfs_dev_t, |
2bd0ea18 NS |
965 | 1: local file \- in-inode directory or symlink, |
966 | 2: extent list, | |
967 | 3: Btree root, | |
968 | 4: unique id [unused]) | |
969 | .br | |
970 | \f3nlinkv1\f1: number of links to the file in a version 1 inode | |
971 | .br | |
972 | \f3nlinkv2\f1: number of links to the file in a version 2 inode | |
973 | .br | |
974 | \f3projid\f1: owner's project id (version 2 inode only) | |
975 | .br | |
976 | \f3uid\f1: owner's user id | |
977 | .br | |
978 | \f3gid\f1: owner's group id | |
979 | .br | |
980 | \f3atime\f1: time last accessed (seconds and nanoseconds) | |
981 | .br | |
982 | \f3mtime\f1: time last modified | |
983 | .br | |
984 | \f3ctime\f1: time created or inode last modified | |
985 | .br | |
986 | \f3size\f1: number of bytes in the file | |
987 | .br | |
988 | \f3nblocks\f1: total number of blocks in the file including | |
989 | indirect and attribute | |
990 | .br | |
399ab595 | 991 | \f3extsize\f1: basic/minimum extent size for the file |
2bd0ea18 NS |
992 | .br |
993 | \f3nextents\f1: number of extents in the data fork | |
994 | .br | |
995 | \f3naextents\f1: number of extents in the attribute fork | |
996 | .br | |
997 | \f3forkoff\f1: attribute fork offset in the inode, | |
998 | in 64-bit words from the start of \f3u\f1 | |
999 | .br | |
1000 | \f3aformat\f1: format of \f3a\f1 data | |
1001 | (1: local attribute data, | |
1002 | 2: extent list, | |
1003 | 3: Btree root) | |
1004 | .br | |
1005 | \f3dmevmask\f1: DMAPI event mask | |
1006 | .br | |
1007 | \f3dmstate\f1: DMAPI state information | |
1008 | .br | |
1009 | \f3newrtbm\f1: file is the realtime bitmap and is ``new'' format | |
1010 | .br | |
1011 | \f3prealloc\f1: file has preallocated data space after EOF | |
1012 | .br | |
1013 | \f3realtime\f1: file data is in the realtime subvolume | |
1014 | .br | |
1015 | \f3gen\f1: inode generation number | |
1016 | .sp | |
1017 | The following fields are in the \f3u\f1 data fork union: | |
1018 | .br | |
1019 | \f3bmbt\f1: bmap Btree root. | |
1020 | This looks like a \f3bmapbtd\f1 block with redundant information removed | |
1021 | .br | |
1022 | \f3bmx\f1: array of extent descriptors | |
1023 | .br | |
1024 | \f3dev\f1: dev_t for the block or character device | |
1025 | .br | |
1026 | \f3sfdir\f1: shortform (in-inode) version 1 directory. | |
d2df702b NS |
1027 | This consists of |
1028 | a \f3hdr\f1 containing | |
2bd0ea18 NS |
1029 | the \f3parent\f1 inode number |
1030 | and a \f3count\f1 of active entries in the directory, | |
d2df702b | 1031 | followed by |
2bd0ea18 | 1032 | an array \f3list\f1 of \f3hdr\f1.\f3count\f1 entries. |
d2df702b NS |
1033 | Each such entry contains |
1034 | \f3inumber\f1, | |
2bd0ea18 NS |
1035 | \f3namelen\f1, |
1036 | and \f3name\f1 string | |
1037 | .br | |
1038 | \f3sfdir2\f1: shortform (in-inode) version 2 directory. | |
d2df702b NS |
1039 | This consists of |
1040 | a \f3hdr\f1 containing | |
2bd0ea18 NS |
1041 | a \f3count\f1 of active entries in the directory, |
1042 | an \f3i8count\f1 of entries with inumbers that don't fit in a 32-bit value, | |
1043 | and the \f3parent\f1 inode number, | |
d2df702b | 1044 | followed by |
2bd0ea18 | 1045 | an array \f3list\f1 of \f3hdr\f1.\f3count\f1 entries. |
d2df702b | 1046 | Each such entry contains |
2bd0ea18 NS |
1047 | \f3namelen\f1, |
1048 | a saved \f3offset\f1 used when the directory is converted to a larger form, | |
1049 | a \f3name\f1 string, | |
1050 | and the \f3inumber\f1 | |
1051 | .br | |
1052 | \f3symlink\f1: symbolic link string value | |
1053 | .sp | |
1054 | The following fields are in the \f3a\f1 attribute fork union if it exists: | |
1055 | .br | |
1056 | \f3bmbt\f1: bmap Btree root, as above | |
1057 | .br | |
1058 | \f3bmx\f1: array of extent descriptors | |
1059 | .br | |
1060 | \f3sfattr\f1: shortform (in-inode) attribute values. | |
1061 | This consists of | |
1062 | a \f3hdr\f1 containing | |
1063 | a \f3totsize\f1 (total size in bytes) | |
1064 | and a \f3count\f1 of active entries, | |
1065 | followed by | |
1066 | an array \f3list\f1 of \f3hdr\f1.\f3count\f1 entries. | |
1067 | Each such entry contains | |
1068 | \f3namelen\f1, | |
1069 | \f3valuelen\f1, | |
1070 | \f3root\f1 flag, | |
1071 | \f3name\f1, | |
1072 | and \f3value\f1 | |
1073 | .TP | |
1074 | \f3log\f1 | |
1075 | Log blocks contain the journal entries for XFS. | |
1076 | It's not useful to examine these with \f2xfs_db\f1, | |
1077 | use \f2xfs_logprint\f1(8) instead. | |
1078 | .TP | |
1079 | \f3rtbitmap\f1 | |
1080 | If the filesystem has a realtime subvolume, then the \f3rbmino\f1 field | |
1081 | in the superblock refers to a file that contains the realtime bitmap. | |
1082 | Each bit in the bitmap file controls the allocation of a single realtime extent | |
1083 | (set == free). | |
1084 | The bitmap is processed in 32-bit words, | |
1085 | the LSB of a word is used for the first extent controlled by that bitmap word. | |
1086 | The \f3atime\f1 field of the realtime bitmap inode contains a counter | |
1087 | that is used to control where the next new realtime file will start. | |
1088 | .TP | |
1089 | \f3rtsummary\f1 | |
1090 | If the filesystem has a realtime subvolume, | |
1091 | then the \f3rsumino\f1 field in the superblock refers to a file | |
1092 | that contains the realtime summary data. | |
1093 | The summary file contains a two-dimensional array of 16-bit values. | |
1094 | Each value counts the number of free extent runs | |
1095 | (consecutive free realtime extents) | |
1096 | of a given range of sizes that starts in a given bitmap block. | |
1097 | The size ranges are binary buckets (low size in the bucket is a power of 2). | |
1098 | There are as many size ranges as are necessary given the size of the | |
1099 | realtime subvolume. | |
1100 | The first dimension is the size range, | |
1101 | the second dimension is the starting bitmap block number | |
1102 | (adjacent entries are for the same size, adjacent bitmap blocks). | |
1103 | .TP | |
1104 | \f3sb\f1 | |
1105 | There is one sb (superblock) structure per allocation group. | |
1106 | It is the first disk block in the allocation group. | |
1107 | Only the first one (block 0 of the filesystem) is actually used; | |
1108 | the other blocks are redundant information for \f2xfs_repair\f1(8) | |
1109 | to use if the first superblock is damaged. | |
1110 | Fields defined: | |
1111 | .br | |
1112 | \f3magicnum\f1: superblock magic number, 0x58465342 ('XFSB') | |
1113 | .br | |
1114 | \f3blocksize\f1: filesystem block size in bytes | |
1115 | .br | |
1116 | \f3dblocks\f1: number of filesystem blocks present in the data subvolume | |
1117 | .br | |
1118 | \f3rblocks\f1: number of filesystem blocks present in the realtime subvolume | |
1119 | .br | |
1120 | \f3rextents\f1: number of realtime extents that \f3rblocks\f1 contain | |
1121 | .br | |
1122 | \f3uuid\f1: unique identifier of the filesystem | |
1123 | .br | |
1124 | \f3logstart\f1: starting filesystem block number of the log (journal). | |
1125 | If this value is 0 the log is ``external'' | |
1126 | .br | |
1127 | \f3rootino\f1: root inode number | |
1128 | .br | |
1129 | \f3rbmino\f1: realtime bitmap inode number | |
1130 | .br | |
1131 | \f3rsumino\f1: realtime summary data inode number | |
1132 | .br | |
1133 | \f3rextsize\f1: realtime extent size in filesystem blocks | |
1134 | .br | |
1135 | \f3agblocks\f1: size of an allocation group in filesystem blocks | |
1136 | .br | |
1137 | \f3agcount\f1: number of allocation groups | |
1138 | .br | |
1139 | \f3rbmblocks\f1: number of realtime bitmap blocks | |
1140 | .br | |
1141 | \f3logblocks\f1: number of log blocks (filesystem blocks) | |
1142 | .br | |
1143 | \f3versionnum\f1: filesystem version information. | |
1144 | This value is currently 1, 2, 3, or 4 in the low 4 bits. | |
1145 | If the low bits are 4 then the other bits have additional meanings. | |
1146 | 1 is the original value. | |
1147 | 2 means that attributes were used. | |
1148 | 3 means that version 2 inodes (large link counts) were used. | |
1149 | 4 is the bitmask version of the version number. | |
1150 | In this case, the other bits are used as flags | |
1151 | (0x0010: attributes were used, | |
1152 | 0x0020: version 2 inodes were used, | |
1153 | 0x0040: quotas were used, | |
1154 | 0x0080: inode cluster alignment is in force, | |
1155 | 0x0100: data stripe alignment is in force, | |
1156 | 0x0200: the \f3shared_vn\f1 field is used, | |
1157 | 0x1000: unwritten extent tracking is on, | |
1158 | 0x2000: version 2 directories are in use) | |
1159 | .br | |
1160 | \f3sectsize\f1: sector size in bytes, currently always 512. | |
1161 | This is the size of the superblock and the other header blocks | |
1162 | .br | |
1163 | \f3inodesize\f1: inode size in bytes | |
1164 | .br | |
1165 | \f3inopblock\f1: number of inodes per filesystem block | |
1166 | .br | |
1167 | \f3fname\f1: obsolete, filesystem name | |
1168 | .br | |
1169 | \f3fpack\f1: obsolete, filesystem pack name | |
1170 | .br | |
1171 | \f3blocklog\f1: log2 of \f3blocksize\f1 | |
1172 | .br | |
1173 | \f3sectlog\f1: log2 of \f3sectsize\f1 | |
1174 | .br | |
1175 | \f3inodelog\f1: log2 of \f3inodesize\f1 | |
1176 | .br | |
1177 | \f3inopblog\f1: log2 of \f3inopblock\f1 | |
1178 | .br | |
1179 | \f3agblklog\f1: log2 of \f3agblocks\f1 (rounded up) | |
1180 | .br | |
1181 | \f3rextslog\f1: log2 of \f3rextents\f1 | |
1182 | .br | |
1183 | \f3inprogress\f1: \f2mkfs.xfs\f1(8) aborted before completing this filesystem | |
1184 | .br | |
1185 | \f3imax_pct\f1: maximum percentage of filesystem space used for inode blocks | |
1186 | .br | |
1187 | \f3icount\f1: number of allocated inodes | |
1188 | .br | |
1189 | \f3ifree\f1: number of allocated inodes that are not in use | |
1190 | .br | |
1191 | \f3fdblocks\f1: number of free data blocks | |
1192 | .br | |
1193 | \f3frextents\f1: number of free realtime extents | |
1194 | .br | |
1195 | \f3uquotino\f1: user quota inode number | |
1196 | .br | |
1197 | \f3pquotino\f1: project quota inode number; this is currently unused | |
1198 | .br | |
1199 | \f3qflags\f1: quota status flags | |
1200 | (0x01: user quota accounting is on, | |
1201 | 0x02: user quota limits are enforced, | |
1202 | 0x04: quotacheck has been run on user quotas, | |
1203 | 0x08: project quota accounting is on, | |
1204 | 0x10: project quota limits are enforced, | |
1205 | 0x20: quotacheck has been run on project quotas) | |
1206 | .br | |
1207 | \f3flags\f1: random flags. | |
1208 | 0x01: only read-only mounts are allowed | |
1209 | .br | |
1210 | \f3shared_vn\f1: shared version number (shared readonly filesystems) | |
1211 | .br | |
1212 | \f3inoalignmt\f1: inode chunk alignment in filesystem blocks | |
1213 | .br | |
1214 | \f3unit\f1: stripe or RAID unit | |
1215 | .br | |
1216 | \f3width\f1: stripe or RAID width | |
1217 | .br | |
1218 | \f3dirblklog\f1: log2 of directory block size (filesystem blocks) | |
1219 | .TP | |
1220 | \f3symlink\f1 | |
1221 | Symbolic link blocks are used only when the symbolic link value does | |
1222 | not fit inside the inode. | |
1223 | The block content is just the string value. | |
1224 | Bytes past the logical end of the symbolic link value have arbitrary values. | |
c6b24b3b NS |
1225 | .TP |
1226 | \f3text\f1 | |
1227 | User file blocks, and other blocks whose type is unknown, | |
1228 | have this type for display purposes in \f2xfs_db\f1. | |
d2df702b | 1229 | The block data is displayed in two columns: Hexadecimal format |
c6b24b3b | 1230 | and printable ASCII chars. |
2bd0ea18 NS |
1231 | .SH DIAGNOSTICS |
1232 | Many messages can come from the \f3check\f1 (\f3blockget\f1) command; | |
1233 | these are documented in \f2xfs_check\f1(8). | |
1234 | .SH SEE ALSO | |
1235 | mkfs.xfs(8), | |
42cf2b97 | 1236 | xfs_admin(8), |
2bd0ea18 NS |
1237 | xfs_check(8), |
1238 | xfs_copy(8), | |
1239 | xfs_logprint(8), | |
1240 | xfs_ncheck(8), | |
1241 | xfs_repair(8), | |
512cfb8a | 1242 | mount(8), |
2bd0ea18 NS |
1243 | chmod(2), |
1244 | mknod(2), | |
1245 | stat(2), | |
1246 | xfs(5). |