1xfs_db(8) System Manager's Manual xfs_db(8)
2
3
4
6 xfs_db - debug an XFS filesystem
7
9 xfs_db [ -c cmd ] ... [ -i|r|x ] [ -f ] [ -l logdev ] [ -p progname ]
10 device
11 xfs_db -V
12
14 xfs_db is used to examine an XFS filesystem. Under rare circumstances
15 it can also be used to modify an XFS filesystem, but that task is nor‐
16 mally left to xfs_repair(8) or to scripts such as xfs_admin(8) that run
17 xfs_db.
18
20 -c cmd xfs_db commands may be run interactively (the default) or as
21 arguments on the command line. Multiple -c arguments may be
22 given. The commands are run in the sequence given, then the pro‐
23 gram exits. This is the mechanism used to implement
24 xfs_check(8).
25
26 -f Specifies that the filesystem image to be processed is stored in
27 a regular file at device (see the mkfs.xfs(8) -d file option).
28 This might happen if an image copy of a filesystem has been made
29 into an ordinary file with xfs_copy(8).
30
31 -i Allows execution on a mounted filesystem, provided it is mounted
32 read-only. Useful for shell scripts such as xfs_check(8), which
33 must only operate on filesystems in a guarenteed consistent
34 state (either unmounted or mounted read-only). These semantics
35 are slightly different to that of the -r option.
36
37 -l logdev
38 Specifies the device where the filesystems external log resides.
39 Only for those filesystems which use an external log. See the
40 mkfs.xfs(8) -l option, and refer to xfs(5) for a detailed
41 description of the XFS log.
42
43 -p progname
44 Set the program name to progname for prompts and some error mes‐
45 sages, the default value is xfs_db.
46
47 -r Open device or filename read-only. This option is required if
48 the filesystem is mounted. It is only necessary to omit this
49 flag if a command that changes data (write, blocktrash) is to be
50 used.
51
52 -x Specifies expert mode. This enables the write and blocktrash
53 commands.
54
55 -V Prints out the current version number and exits.
56
58 xfs_db commands can be broken up into two classes. Most commands are
59 for the navigation and display of data structures in the filesystem.
60 Other commands are for scanning the filesystem in some way.
61
62 Commands which are used to navigate the filesystem structure take argu‐
63 ments which reflect the names of filesystem structure fields. There
64 can be multiple field names separated by dots when the underlying
65 structures are nested, as in C. The field names can be indexed (as an
66 array index) if the underlying field is an array. The array indices
67 can be specified as a range, two numbers separated by a dash.
68
69 xfs_db maintains a current address in the filesystem. The granularity
70 of the address is a filesystem structure. This can be a filesystem
71 block, an inode or quota (smaller than a filesystem block), or a direc‐
72 tory block (could be larger than a filesystem block). There are a
73 variety of commands to set the current address. Associated with the
74 current address is the current data type, which is the structural type
75 of this data. Commands which follow the structure of the filesystem
76 always set the type as well as the address. Commands which examine
77 pieces of an individual file (inode) need the current inode to be set,
78 this is done with the inode command.
79
80 The current address/type information is actually maintained in a stack
81 that can be explicitly manipulated with the push, pop, and stack com‐
82 mands. This allows for easy examination of a nested filesystem struc‐
83 ture. Also, the last several locations visited are stored in a ring
84 buffer which can be manipulated with the forward, back, and ring com‐
85 mands.
86
87 XFS filesystems are divided into a small number of allocation groups.
88 xfs_db maintains a notion of the current allocation group which is
89 manipulated by some commands. The initial allocation group is 0.
90
92 Many commands have extensive online help. Use the help command for more
93 details on any command.
94
95 a See the addr command.
96
97 ablock filoff
98 Set current address to the offset . I filoff (a filesystem
99 block number) in the attribute area of the current inode.
100
101 addr [field-expression]
102 Set current address to the value of the field-expression. This
103 is used to "follow" a reference in one structure to the object
104 being referred to. If no argument is given the current address
105 is printed.
106
107 agf [agno]
108 Set current address to the AGF block for allocation group agno.
109 If no argument is given use the current allocation group.
110
111 agfl [agno]
112 Set current address to the AGFL block for allocation group agno.
113 If no argument is given use the current allocation group.
114
115 agi [agno]
116 Set current address to the AGI block for allocation group agno.
117 If no argument is given use the current allocation group.
118
119 b See the back command.
120
121 back Move to the previous location in the position ring.
122
123 blockfree
124 Free block usage information collected by the last execution of
125 the blockget command. This must be done before another blockget
126 command can be given, presumably with different arguments than
127 the previous one.
128
129 blockget [-npvs] [-b bno] ... [-i ino] ...
130 Get block usage and check filesystem consistency. The informa‐
131 tion is saved for use by a subsequent blockuse, ncheck, or
132 blocktrash command. See xfs_check(8) for more information.
133
134 -b is used to specify filesystem block numbers about which
135 verbose information should be printed.
136
137 -i is used to specify inode numbers about which verbose
138 information should be printed.
139
140 -n is used to save pathnames for inodes visited, this is
141 used to support the xfs_ncheck(8) command. It also means
142 that pathnames will be printed for inodes that have prob‐
143 lems. This option uses a lot of memory so is not enabled
144 by default.
145
146 -p causes error messages to be prefixed with the filesystem
147 name being processed. This is useful if several copies of
148 xfs_db are run in parallel.
149
150 -s restricts output to severe errors only. This is useful if
151 the output is too long otherwise.
152
153 -v enables verbose output. Messages will be printed for
154 every block and inode processed.
155
156 blocktrash [-n count] [-x min] [-y max] [-s seed] [-0|1|2|3] [-t type]
157 ...
158 Trash randomly selected filesystem metadata blocks. Trashing
159 occurs to randomly selected bits in the chosen blocks. This
160 command is available only in debugging versions of xfs_db. It
161 is useful for testing xfs_repair(8) and xfs_check(8).
162
163 -0 | -1 | -2 | -3
164 These are used to set the operating mode for blocktrash.
165 Only one can be used: -0 changed bits are cleared; -1
166 changed bits are set; -2 changed bits are inverted; -3
167 changed bits are randomized.
168
169 -n supplies the count of block-trashings to perform (default
170 1).
171
172 -s supplies a seed to the random processing.
173
174 -t gives a type of blocks to be selected for trashing. Mul‐
175 tiple -t options may be given. If no -t options are given
176 then all metadata types can be trashed.
177
178 -x sets the minimum size of bit range to be trashed. The
179 default value is 1.
180
181 -y sets the maximum size of bit range to be trashed. The
182 default value is 1024.
183
184 blockuse [-n] [-c count]
185 Print usage for current filesystem block(s). For each block,
186 the type and (if any) inode are printed.
187
188 -c specifies a count of blocks to process. The default value
189 is 1 (the current block only).
190
191 -n specifies that file names should be printed. The prior
192 blockget command must have also specified the -n option.
193
194 bmap [-a] [-d] [block [len]]
195 Show the block map for the current inode. The map display can
196 be restricted to an area of the file with the block and len
197 arguments. If block is given and len is omitted then 1 is
198 assumed for len.
199
200 The -a and -d options are used to select the attribute or data
201 area of the inode, if neither option is given then both areas
202 are shown.
203
204 check See the blockget command.
205
206 convert type number [type number] ... type
207 Convert from one address form to another. The known types, with
208 alternate names, are:
209 agblock or agbno (filesystem block within an allocation
210 group)
211 agino or aginode (inode number within an allocation group)
212 agnumber or agno (allocation group number)
213 bboff or daddroff (byte offset in a daddr)
214 blkoff or fsboff or agboff (byte offset in a agblock or
215 fsblock)
216 byte or fsbyte (byte address in filesystem)
217 daddr or bb (disk address, 512-byte blocks)
218 fsblock or fsb or fsbno (filesystem block, see the fsblock
219 command)
220 ino or inode (inode number)
221 inoidx or offset (index of inode in filesystem block)
222 inooff or inodeoff (byte offset in inode)
223
224 Only conversions that "make sense" are allowed. The compound
225 form (with more than three arguments) is useful for conversions
226 such as convert agno ag agbno agb fsblock.
227
228 daddr [d]
229 Set current address to the daddr (512 byte block) given by d.
230 If no value for d is given the current address is printed,
231 expressed as a daddr. The type is set to . data (uninter‐
232 preted).
233
234 dblock filoff
235 Set current address to the offset filoff (a filesystem block
236 number) in the data area of the current inode.
237
238 debug [flagbits]
239 Set debug option bits. These are used for debugging xfs_db. If
240 no value is given for flagbits, print the current debug option
241 bits. These are for the use of the implementor.
242
243 dquot [projectid_or_userid]
244 Set current address to a project or user quota block.
245
246 echo [arg] ...
247 Echo the arguments to the output.
248
249 f See the forward command.
250
251 forward
252 Move forward to the next entry in the position ring.
253
254 frag [-adflqRrv]
255 Get file fragmentation data. This prints information about frag‐
256 mentation of file data in the filesystem (as opposed to fragmen‐
257 tation of freespace, for which see the freesp command). Every
258 file in the filesystem is examined to see how far from ideal its
259 extent mappings are. A summary is printed giving the totals.
260
261 -v sets verbosity, every inode has information printed for
262 it. The remaining options select which inodes and
263 extents are examined. If no options are given then all
264 are assumed set, otherwise just those given are enabled.
265
266 -a enables processing of attribute data.
267
268 -d enables processing of directory data.
269
270 -f enables processing of regular file data.
271
272 -l enables processing of symbolic link data.
273
274 -q enables processing of quota file data.
275
276 -R enables processing of realtime control file data.
277
278 -r enables processing of realtime file data.
279
280 freesp [-bcds] [-a ag] ... [-e i] [-h h1] ... [-m m]
281 Summarize free space for the filesystem. The free blocks are
282 examined and totalled, and displayed in the form of a histogram,
283 with a count of extents in each range of free extent sizes.
284
285 -a adds ag to the list of allocation groups to be processed.
286 If no -a options are given then all allocation groups are
287 processed.
288
289 -b specifies that the histogram buckets are binary-sized,
290 with the starting sizes being the powers of 2.
291
292 -c specifies that freesp will search the by-size (cnt) space
293 Btree instead of the default by-block (bno) space Btree.
294
295 -d specifies that every free extent will be displayed.
296
297 -e specifies that the histogram buckets are equal-sized,
298 with the size specified as i.
299
300 -h specifies a starting block number for a histogram bucket
301 as h1. Multiple -h's are given to specify the complete
302 set of buckets.
303
304 -m specifies that the histogram starting block numbers are
305 powers of m. This is the general case of -b.
306
307 -s specifies that a final summary of total free extents,
308 free blocks, and the average free extent size is printed.
309
310 fsb See the fsblock command.
311
312 fsblock [fsb]
313 Set current address to the fsblock value given by fsb. If no
314 value for fsb is given the current address is printed, expressed
315 as an fsb. The type is set to data (uninterpreted). XFS
316 filesystem block numbers are computed ((agno << agshift) |
317 agblock) where agshift depends on the size of an allocation
318 group. Use the convert command to convert to and from this form.
319 Block numbers given for file blocks (for instance from the bmap
320 command) are in this form.
321
322 hash string
323 Prints the hash value of string using the hash function of the
324 XFS directory and attribute implementation.
325
326 help [command]
327 Print help for one or all commands.
328
329 inode [inode#]
330 Set the current inode number. If no inode# is given, print the
331 current inode number.
332
333 label [label]
334 Set the filesystem label. The filesystem label can be used by
335 mount(8) instead of using a device special file. The maximum
336 length of an XFS label is 12 characters - use of a longer label
337 will result in truncation and a warning will be issued. If no
338 label is given, the current filesystem label is printed.
339
340 log [stop | start filename]
341 Start logging output to filename, stop logging, or print the
342 current logging status.
343
344 metadump [-egow] filename
345 Dumps metadata to a file. See xfs_metadump(8) for more informa‐
346 tion.
347
348 ncheck [-s] [-i ino] ...
349 Print name-inode pairs. A blockget -n command must be run first
350 to gather the information.
351
352 -i specifies an inode number to be printed. If no -i options
353 are given then all inodes are printed.
354
355 -s specifies that only setuid and setgid files are printed.
356
357 p See the print command.
358
359 pop Pop location from the stack.
360
361 print [field-expression] ...
362 Print field values. If no argument is given, print all fields
363 in the current structure.
364
365 push [command]
366 Push location to the stack. If command is supplied, set the cur‐
367 rent location to the results of command after pushing the old
368 location.
369
370 q See the quit command.
371
372 quit Exit xfs_db.
373
374 ring [index]
375 Show position ring (if no index argument is given), or move to a
376 specific entry in the position ring given by index.
377
378 sb [agno]
379 Set current address to SB header in allocation group agno. If
380 no agno is given use the current allocation group number.
381
382 source source-file
383 Process commands from source-file. source commands can be
384 nested.
385
386 stack View the location stack.
387
388 type [type]
389 Set the current data type to type. If no argument is given,
390 show the current data type. The possible data types are: agf,
391 agfl, agi, attr, bmapbta, bmapbtd, bnobt, cntbt, data, dir,
392 dir2, dqblk, inobt, inode, log, rtbitmap, rtsummary, sb, symlink
393 and text. See the TYPES section below for more information on
394 these data types.
395
396 uuid [uuid | generate | rewrite]
397 Set the filesystem universally unique identifier (UUID). The
398 filesystem UUID can be used by mount(8) instead of using a
399 device special file. The uuid can be set directly to the
400 desired UUID, or it can be automatically generated using the
401 generate option. These options will both write the UUID into
402 every copy of the superblock in the filesystem. rewrite copies
403 the current UUID from the primary superblock to all secondary
404 copies of the superblock. If no argument is given, the current
405 filesystem UUID is printed.
406
407 version [feature | versionnum features2]
408 Enable selected features for a filesystem (certain features can
409 be enabled on an unmounted filesystem, after mkfs.xfs(8) has
410 created the filesystem). Support for unwritten extents can be
411 enabled using the extflg option. Support for version 2 log for‐
412 mat can be enabled using the log2 option. Support for extended
413 attributes can be enabled using the attr1 or attr2 option. Once
414 enabled, extended attributes cannot be disabled, but the user
415 may toggle between attr1 and attr2 at will (older kernels may
416 not support the newer version).
417
418 If no argument is given, the current version and feature bits
419 are printed. With one argument, this command will write the
420 updated version number into every copy of the superblock in the
421 filesystem. If two arguments are given, they will be used as
422 numeric values for the versionnum and features2 bits respec‐
423 tively, and their string equivalent reported (but no modifica‐
424 tions are made).
425
426 write [field value] ...
427 Write a value to disk. Specific fields can be set in structures
428 (struct mode), or a block can be set to data values (data mode),
429 or a block can be set to string values (string mode, for symlink
430 blocks). The operation happens immediately: there is no buffer‐
431 ing.
432
433 Struct mode is in effect when the current type is structural,
434 i.e. not data. For struct mode, the syntax is "write field
435 value".
436
437 Data mode is in effect when the current type is data. In this
438 case the contents of the block can be shifted or rotated left or
439 right, or filled with a sequence, a constant value, or a random
440 value. In this mode write with no arguments gives more informa‐
441 tion on the allowed commands.
442
444 This section gives the fields in each structure type and their mean‐
445 ings. Note that some types of block cover multiple actual structures,
446 for instance directory blocks.
447
448 agf The AGF block is the header for block allocation information;
449 it is in the second 512-byte block of each allocation group.
450 The following fields are defined:
451 magicnum AGF block magic number, 0x58414746 ('XAGF').
452 versionnum version number, currently 1.
453 seqno sequence number starting from 0.
454 length size in filesystem blocks of the allocation
455 group. All allocation groups except the last
456 one of the filesystem have the superblock's
457 agblocks value here.
458 bnoroot block number of the root of the Btree holding
459 free space information sorted by block num‐
460 ber.
461 cntroot block number of the root of the Btree holding
462 free space information sorted by block count.
463 bnolevel number of levels in the by-block-number
464 Btree.
465 cntlevel number of levels in the by-block-count Btree.
466 flfirst index into the AGFL block of the first active
467 entry.
468 fllast index into the AGFL block of the last active
469 entry.
470 flcount count of active entries in the AGFL block.
471 freeblks count of blocks represented in the freespace
472 Btrees.
473 longest longest free space represented in the
474 freespace Btrees.
475 btreeblks number of blocks held in the AGF Btrees.
476
477 agf The AGFL block contains block numbers for use of the block
478 allocator; it is in the fourth 512-byte block of each alloca‐
479 tion group. Each entry in the active list is a block number
480 within the allocation group that can be used for any purpose
481 if space runs low. The AGF block fields flfirst, fllast, and
482 flcount designate which entries are currently active. Entry
483 space is allocated in a circular manner within the AGFL
484 block. Fields defined:
485 bno array of all block numbers. Even those which
486 are not active are printed.
487
488 agi The AGI block is the header for inode allocation information;
489 it is in the third 512-byte block of each allocation group.
490 Fields defined:
491 magicnum AGI block magic number, 0x58414749 ('XAGI').
492 versionnum version number, currently 1.
493 seqno sequence number starting from 0.
494 length size in filesystem blocks of the allocation
495 group.
496 count count of inodes allocated.
497 root block number of the root of the Btree holding
498 inode allocation information.
499 level number of levels in the inode allocation
500 Btree.
501 freecount count of allocated inodes that are not in
502 use.
503 newino last inode number allocated.
504 dirino unused.
505 unlinked an array of inode numbers within the alloca‐
506 tion group. The entries in the AGI block are
507 the heads of lists which run through the
508 inode next_unlinked field. These inodes are
509 to be unlinked the next time the filesystem
510 is mounted.
511
512 attr An attribute fork is organized as a Btree with the actual
513 data embedded in the leaf blocks. The root of the Btree is
514 found in block 0 of the fork. The index (sort order) of the
515 Btree is the hash value of the attribute name. All the
516 blocks contain a blkinfo structure at the beginning, see type
517 dir for a description. Nonleaf blocks are identical in format
518 to those for version 1 and version 2 directories, see type
519 dir for a description. Leaf blocks can refer to "local" or
520 "remote" attribute values. Local values are stored directly
521 in the leaf block. Remote values are stored in an indepen‐
522 dent block in the attribute fork (with no structure). Leaf
523 blocks contain the following fields:
524 hdr header containing a blkinfo structure info
525 (magic number 0xfbee), a count of active
526 entries, usedbytes total bytes of names and
527 values, the firstused byte in the name area,
528 holes set if the block needs compaction, and
529 array freemap as for dir leaf blocks.
530 entries array of structures containing a hashval,
531 nameidx (index into the block of the name),
532 and flags incomplete, root, and local.
533 nvlist array of structures describing the attribute
534 names and values. Fields always present: val‐
535 uelen (length of value in bytes), namelen,
536 and name. Fields present for local values:
537 value (value string). Fields present for
538 remote values: valueblk (fork block number of
539 containing the value).
540
541 bmapbt Files with many extents in their data or attribute fork will
542 have the extents described by the contents of a Btree for
543 that fork, instead of being stored directly in the inode.
544 Each bmap Btree starts with a root block contained within the
545 inode. The other levels of the Btree are stored in filesys‐
546 tem blocks. The blocks are linked to sibling left and right
547 blocks at each level, as well as by pointers from parent to
548 child blocks. Each block contains the following fields:
549 magic bmap Btree block magic number, 0x424d4150
550 ('BMAP').
551 level level of this block above the leaf level.
552 numrecs number of records or keys in the block.
553 leftsib left (logically lower) sibling block, 0 if
554 none.
555 rightsib right (logically higher) sibling block, 0 if
556 none.
557 recs [leaf blocks only] array of extent records.
558 Each record contains startoff, startblock,
559 blockcount, and extentflag (1 if the extent
560 is unwritten).
561 keys [nonleaf blocks only] array of key records.
562 These are the first key value of each block
563 in the level below this one. Each record con‐
564 tains startoff.
565 ptrs [nonleaf blocks only] array of child block
566 pointers. Each pointer is a filesystem block
567 number to the next level in the Btree.
568
569 bnobt There is one set of filesystem blocks forming the by-block-
570 number allocation Btree for each allocation group. The root
571 block of this Btree is designated by the bnoroot field in the
572 coresponding AGF block. The blocks are linked to sibling
573 left and right blocks at each level, as well as by pointers
574 from parent to child blocks. Each block has the following
575 fields:
576 magic BNOBT block magic number, 0x41425442
577 ('ABTB').
578 level level number of this block, 0 is a leaf.
579 numrecs number of data entries in the block.
580 leftsib left (logically lower) sibling block, 0 if
581 none.
582 rightsib right (logically higher) sibling block, 0 if
583 none.
584 recs [leaf blocks only] array of freespace
585 records. Each record contains startblock and
586 blockcount.
587 keys [nonleaf blocks only] array of key records.
588 These are the first value of each block in
589 the level below this one. Each record con‐
590 tains startblock and blockcount.
591 ptrs [nonleaf blocks only] array of child block
592 pointers. Each pointer is a block number
593 within the allocation group to the next level
594 in the Btree.
595
596 cntbt There is one set of filesystem blocks forming the by-block-
597 count allocation Btree for each allocation group. The root
598 block of this Btree is designated by the cntroot field in the
599 coresponding AGF block. The blocks are linked to sibling left
600 and right blocks at each level, as well as by pointers from
601 parent to child blocks. Each block has the following fields:
602 magic CNTBT block magic number, 0x41425443
603 ('ABTC').
604 level level number of this block, 0 is a leaf.
605 numrecs number of data entries in the block.
606 leftsib left (logically lower) sibling block, 0 if
607 none.
608 rightsib right (logically higher) sibling block, 0 if
609 none.
610 recs [leaf blocks only] array of freespace
611 records. Each record contains startblock and
612 blockcount.
613 keys [nonleaf blocks only] array of key records.
614 These are the first value of each block in
615 the level below this one. Each record con‐
616 tains blockcount and startblock.
617 ptrs [nonleaf blocks only] array of child block
618 pointers. Each pointer is a block number
619 within the allocation group to the next level
620 in the Btree.
621
622 data User file blocks, and other blocks whose type is unknown,
623 have this type for display purposes in xfs_db. The block
624 data is displayed in hexadecimal format.
625
626 dir A version 1 directory is organized as a Btree with the direc‐
627 tory data embedded in the leaf blocks. The root of the Btree
628 is found in block 0 of the file. The index (sort order) of
629 the Btree is the hash value of the entry name. All the blocks
630 contain a blkinfo structure at the beginning with the follow‐
631 ing fields:
632 forw next sibling block.
633 back previous sibling block.
634 magic magic number for this block type.
635 The non-leaf (node) blocks have the following fields:
636 hdr header containing a blkinfo structure info
637 (magic number 0xfebe), the count of active
638 entries, and the level of this block above
639 the leaves.
640 btree array of entries containing hashval and
641 before fields. The before value is a block
642 number within the directory file to the child
643 block, the hashval is the last hash value in
644 that block.
645 The leaf blocks have the following fields:
646 hdr header containing a blkinfo structure info
647 (magic number 0xfeeb), the count of active
648 entries, namebytes (total name string bytes),
649 holes flag (block needs compaction), and
650 freemap (array of base, size entries for free
651 regions).
652 entries array of structures containing hashval,
653 nameidx (byte index into the block of the
654 name string), and namelen.
655 namelist array of structures containing inumber and
656 name.
657
658 dir2 A version 2 directory has four kinds of blocks. Data blocks
659 start at offset 0 in the file. There are two kinds of data
660 blocks: single-block directories have the leaf information
661 embedded at the end of the block, data blocks in multi-block
662 directories do not. Node and leaf blocks start at offset
663 32GiB (with either a single leaf block or the root node
664 block). Freespace blocks start at offset 64GiB. The node
665 and leaf blocks form a Btree, with references to the data in
666 the data blocks. The freespace blocks form an index of long‐
667 est free spaces within the data blocks.
668
669 A single-block directory block contains the following fields:
670 bhdr header containing magic number 0x58443242
671 ('XD2B') and an array bestfree of the longest
672 3 free spaces in the block (offset, length).
673 bu array of union structures. Each element is
674 either an entry or a freespace. For entries,
675 there are the following fields: inumber,
676 namelen, name, and tag. For freespace, there
677 are the following fields: freetag [22m(0xffff),
678 length, and tag. The tag value is the byte
679 offset in the block of the start of the entry
680 it is contained in.
681 bleaf array of leaf entries containing hashval and
682 address. The address is a 64-bit word offset
683 into the file.
684 btail tail structure containing the total count of
685 leaf entries and stale count of unused leaf
686 entries.
687 A data block contains the following fields:
688 dhdr header containing magic number 0x58443244
689 ('XD2D') and an array bestfree of the longest
690 3 free spaces in the block (offset, length).
691 du array of union structures as for bu.
692 Leaf blocks have two possible forms. If the Btree consists of
693 a single leaf then the freespace information is in the leaf
694 block, otherwise it is in separate blocks and the root of the
695 Btree is a node block. A leaf block contains the following
696 fields:
697 lhdr header containing a blkinfo structure info
698 (magic number 0xd2f1 for the single leaf
699 case, 0xd2ff for the true Btree case), the
700 total count of leaf entries, and stale count
701 of unused leaf entries.
702 lents leaf entries, as for bleaf.
703 lbests [single leaf only] array of values which rep‐
704 resent the longest freespace in each data
705 block in the directory.
706 ltail [single leaf only] tail structure containing
707 bestcount count of lbests.
708 A node block is identical to that for types attr and dir.
709
710 A freespace block contains the following fields:
711 fhdr header containing magic number 0x58443246
712 ('XD2F'), firstdb first data block number
713 covered by this freespace block, nvalid num‐
714 ber of valid entries, and nused number of
715 entries representing real data blocks.
716 fbests array of values as for lbests.
717
718 dqblk The quota information is stored in files referred to by the
719 superblock uquotino and pquotino fields. Each filesystem
720 block in a quota file contains a constant number of quota
721 entries. The quota entry size is currently 136 bytes, so with
722 a 4KiB filesystem block size there are 30 quota entries per
723 block. The dquot command is used to locate these entries in
724 the filesystem. The file entries are indexed by the user or
725 project identifier to determine the block and offset. Each
726 quota entry has the following fields:
727 magic magic number, 0x4451 ('DQ').
728 version version number, currently 1.
729 flags flags, values include 0x01 for user quota,
730 0x02 for project quota.
731 id user or project identifier.
732 blk_hardlimit absolute limit on blocks in use.
733 blk_softlimit preferred limit on blocks in use.
734 ino_hardlimit absolute limit on inodes in use.
735 ino_softlimit preferred limit on inodes in use.
736 bcount blocks actually in use.
737 icount inodes actually in use.
738 itimer time when service will be refused if soft
739 limit is violated for inodes.
740 btimer time when service will be refused if soft
741 limit is violated for blocks.
742 iwarns number of warnings issued about inode
743 limit violations.
744 bwarns number of warnings issued about block
745 limit violations.
746 rtb_hardlimit absolute limit on realtime blocks in use.
747 rtb_softlimit preferred limit on realtime blocks in use.
748 rtbcount realtime blocks actually in use.
749 rtbtimer time when service will be refused if soft
750 limit is violated for realtime blocks.
751 rtbwarns number of warnings issued about realtime
752 block limit violations.
753
754 inobt There is one set of filesystem blocks forming the inode allo‐
755 cation Btree for each allocation group. The root block of
756 this Btree is designated by the root field in the corespond‐
757 ing AGI block. The blocks are linked to sibling left and
758 right blocks at each level, as well as by pointers from par‐
759 ent to child blocks. Each block has the following fields:
760 magic INOBT block magic number, 0x49414254
761 ('IABT').
762 level level number of this block, 0 is a leaf.
763 numrecs number of data entries in the block.
764 leftsib left (logically lower) sibling block, 0 if
765 none.
766 rightsib right (logically higher) sibling block, 0 if
767 none.
768 recs [leaf blocks only] array of inode records.
769 Each record contains startino allocation-
770 group relative inode number, freecount count
771 of free inodes in this chunk, and free bit‐
772 map, LSB corresponds to inode 0.
773 keys [nonleaf blocks only] array of key records.
774 These are the first value of each block in
775 the level below this one. Each record con‐
776 tains startino.
777 ptrs [nonleaf blocks only] array of child block
778 pointers. Each pointer is a block number
779 within the allocation group to the next level
780 in the Btree.
781
782 inode Inodes are allocated in "chunks" of 64 inodes each. Usually a
783 chunk is multiple filesystem blocks, although there are cases
784 with large filesystem blocks where a chunk is less than one
785 block. The inode Btree (see inobt above) refers to the inode
786 numbers per allocation group. The inode numbers directly
787 reflect the location of the inode block on disk. Use the
788 inode command to point xfs_db to a specific inode. Each inode
789 contains four regions: core, next_unlinked, u, and a. core
790 contains the fixed information. next_unlinked is separated
791 from the core due to journaling considerations, see type agi
792 field unlinked. u is a union structure that is different in
793 size and format depending on the type and representation of
794 the file data ("data fork"). a is an optional union struc‐
795 ture to describe attribute data, that is different in size,
796 format, and location depending on the presence and represen‐
797 tation of attribute data, and the size of the u data
798 ("attribute fork"). xfs_db automatically selects the proper
799 union members based on information in the inode.
800
801 The following are fields in the inode core:
802 magic inode magic number, 0x494e ('IN').
803 mode mode and type of file, as described in
804 chmod(2), mknod(2), and stat(2).
805 version inode version, 1 or 2.
806 format format of u union data (0: xfs_dev_t, 1:
807 local file - in-inode directory or symlink,
808 2: extent list, 3: Btree root, 4: unique id
809 [unused]).
810 nlinkv1 number of links to the file in a version 1
811 inode.
812 nlinkv2 number of links to the file in a version 2
813 inode.
814 projid owner's project id (version 2 inode only).
815 uid owner's user id.
816 gid owner's group id.
817 atime time last accessed (seconds and nanoseconds).
818 mtime time last modified.
819 ctime time created or inode last modified.
820 size number of bytes in the file.
821 nblocks total number of blocks in the file including
822 indirect and attribute.
823 extsize basic/minimum extent size for the file.
824 nextents number of extents in the data fork.
825 naextents number of extents in the attribute fork.
826 forkoff attribute fork offset in the inode, in 64-bit
827 words from the start of u.
828 aformat format of a data (1: local attribute data, 2:
829 extent list, 3: Btree root).
830 dmevmask DMAPI event mask.
831 dmstate DMAPI state information.
832 newrtbm file is the realtime bitmap and is "new" for‐
833 mat.
834 prealloc file has preallocated data space after EOF.
835 realtime file data is in the realtime subvolume.
836 gen inode generation number.
837 The following fields are in the u data fork union:
838 bmbt bmap Btree root. This looks like a bmapbtd
839 block with redundant information removed.
840 bmx array of extent descriptors.
841 dev dev_t for the block or character device.
842 sfdir shortform (in-inode) version 1 directory.
843 This consists of a hdr containing the parent
844 inode number and a count of active entries in
845 the directory, followed by an array list of
846 hdr.count entries. Each such entry contains
847 inumber, namelen, and name string.
848 sfdir2 shortform (in-inode) version 2 directory.
849 This consists of a hdr containing a count of
850 active entries in the directory, an i8count
851 of entries with inumbers that don't fit in a
852 32-bit value, and the parent inode number,
853 followed by an array list of hdr.count
854 entries. Each such entry contains namelen, a
855 saved offset used when the directory is con‐
856 verted to a larger form, a name string, and
857 the inumber.
858 symlink symbolic link string value.
859 The following fields are in the a attribute fork union if it
860 exists:
861 bmbt bmap Btree root, as above.
862 bmx array of extent descriptors.
863 sfattr shortform (in-inode) attribute values. This
864 consists of a hdr containing a totsize (total
865 size in bytes) and a count of active entries,
866 followed by an array list of hdr.count
867 entries. Each such entry contains namelen,
868 valuelen, root flag, name, and value.
869
870 log Log blocks contain the journal entries for XFS. It's not
871 useful to examine these with xfs_db, use xfs_logprint(8)
872 instead.
873
874 rtbitmap If the filesystem has a realtime subvolume, then the rbmino
875 field in the superblock refers to a file that contains the
876 realtime bitmap. Each bit in the bitmap file controls the
877 allocation of a single realtime extent (set == free). The
878 bitmap is processed in 32-bit words, the LSB of a word is
879 used for the first extent controlled by that bitmap word. The
880 atime field of the realtime bitmap inode contains a counter
881 that is used to control where the next new realtime file will
882 start.
883
884 rtsummary If the filesystem has a realtime subvolume, then the rsumino
885 field in the superblock refers to a file that contains the
886 realtime summary data. The summary file contains a two-dimen‐
887 sional array of 16-bit values. Each value counts the number
888 of free extent runs (consecutive free realtime extents) of a
889 given range of sizes that starts in a given bitmap block.
890 The size ranges are binary buckets (low size in the bucket is
891 a power of 2). There are as many size ranges as are neces‐
892 sary given the size of the realtime subvolume. The first
893 dimension is the size range, the second dimension is the
894 starting bitmap block number (adjacent entries are for the
895 same size, adjacent bitmap blocks).
896
897 sb There is one sb (superblock) structure per allocation group.
898 It is the first disk block in the allocation group. Only the
899 first one (block 0 of the filesystem) is actually used; the
900 other blocks are redundant information for xfs_repair(8) to
901 use if the first superblock is damaged. Fields defined:
902 magicnum superblock magic number, 0x58465342 ('XFSB').
903 blocksize filesystem block size in bytes.
904 dblocks number of filesystem blocks present in the
905 data subvolume.
906 rblocks number of filesystem blocks present in the
907 realtime subvolume.
908 rextents number of realtime extents that rblocks con‐
909 tain.
910 uuid unique identifier of the filesystem.
911 logstart starting filesystem block number of the log
912 (journal). If this value is 0 the log is
913 "external".
914 rootino root inode number.
915 rbmino realtime bitmap inode number.
916 rsumino realtime summary data inode number.
917 rextsize realtime extent size in filesystem blocks.
918 agblocks size of an allocation group in filesystem
919 blocks.
920 agcount number of allocation groups.
921 rbmblocks number of realtime bitmap blocks.
922 logblocks number of log blocks (filesystem blocks).
923 versionnum filesystem version information. This value
924 is currently 1, 2, 3, or 4 in the low 4 bits.
925 If the low bits are 4 then the other bits
926 have additional meanings. 1 is the original
927 value. 2 means that attributes were used. 3
928 means that version 2 inodes (large link
929 counts) were used. 4 is the bitmask version
930 of the version number. In this case, the
931 other bits are used as flags (0x0010:
932 attributes were used, 0x0020: version 2
933 inodes were used, 0x0040: quotas were used,
934 0x0080: inode cluster alignment is in force,
935 0x0100: data stripe alignment is in force,
936 0x0200: the shared_vn field is used, 0x1000:
937 unwritten extent tracking is on, 0x2000: ver‐
938 sion 2 directories are in use).
939 sectsize sector size in bytes, currently always 512.
940 This is the size of the superblock and the
941 other header blocks.
942 inodesize inode size in bytes.
943 inopblock number of inodes per filesystem block.
944 fname obsolete, filesystem name.
945 fpack obsolete, filesystem pack name.
946 blocklog log2 of blocksize.
947 sectlog log2 of sectsize.
948 inodelog log2 of inodesize.
949 inopblog log2 of inopblock.
950 agblklog log2 of agblocks (rounded up).
951 rextslog log2 of rextents.
952 inprogress mkfs.xfs(8) or xfs_copy(8) aborted before
953 completing this filesystem.
954 imax_pct maximum percentage of filesystem space used
955 for inode blocks.
956 icount number of allocated inodes.
957 ifree number of allocated inodes that are not in
958 use.
959 fdblocks number of free data blocks.
960 frextents number of free realtime extents.
961 uquotino user quota inode number.
962 pquotino project quota inode number; this is currently
963 unused.
964 qflags quota status flags (0x01: user quota account‐
965 ing is on, 0x02: user quota limits are
966 enforced, 0x04: quotacheck has been run on
967 user quotas, 0x08: project quota accounting
968 is on, 0x10: project quota limits are
969 enforced, 0x20: quotacheck has been run on
970 project quotas).
971 flags random flags. 0x01: only read-only mounts are
972 allowed.
973 shared_vn shared version number (shared readonly
974 filesystems).
975 inoalignmt inode chunk alignment in filesystem blocks.
976 unit stripe or RAID unit.
977 width stripe or RAID width.
978 dirblklog log2 of directory block size (filesystem
979 blocks).
980
981 symlink Symbolic link blocks are used only when the symbolic link
982 value does not fit inside the inode. The block content is
983 just the string value. Bytes past the logical end of the
984 symbolic link value have arbitrary values.
985
986 text User file blocks, and other blocks whose type is unknown,
987 have this type for display purposes in xfs_db. The block
988 data is displayed in two columns: Hexadecimal format and
989 printable ASCII chars.
990
992 Many messages can come from the check (blockget) command; these are
993 documented in xfs_check(8).
994
996 mkfs.xfs(8), xfs_admin(8), xfs_check(8), xfs_copy(8), xfs_logprint(8),
997 xfs_metadump(8), xfs_ncheck(8), xfs_repair(8), mount(8), chmod(2),
998 mknod(2), stat(2), xfs(5).
999
1000
1001
1002 xfs_db(8)