]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - man/man8/xfs_db.8
xfs_db: print attribute remote value blocks
[thirdparty/xfsprogs-dev.git] / man / man8 / xfs_db.8
CommitLineData
2bd0ea18
NS
1.TH xfs_db 8
2.SH NAME
3xfs_db \- debug an XFS filesystem
4.SH SYNOPSIS
2017d0d0
BN
5.B xfs_db
6[
7.B \-c
8.I cmd
9] ... [
7f98455a 10.BR \-i | r | x | F
2017d0d0
BN
11] [
12.B \-f
13] [
14.B \-l
15.I logdev
16] [
17.B \-p
18.I progname
19]
20.I device
21.br
22.B xfs_db \-V
2bd0ea18 23.SH DESCRIPTION
2017d0d0
BN
24.B xfs_db
25is used to examine an XFS filesystem. Under rare circumstances it can also
26be used to modify an XFS filesystem, but that task is normally left to
27.BR xfs_repair (8)
28or to scripts such as
29.BR xfs_admin (8)
30that run
31.BR xfs_db .
2bd0ea18 32.PP
2017d0d0
BN
33.SH OPTIONS
34.TP
35.BI \-c " cmd"
36.B xfs_db
37commands may be run interactively (the default) or as arguments
38on the command line. Multiple
39.B \-c
40arguments may be given. The commands are run in the sequence given,
bfc541e7 41then the program exits.
2017d0d0
BN
42.TP
43.B \-f
d2df702b 44Specifies that the filesystem image to be processed is stored in a
2017d0d0
BN
45regular file at
46.I device
47(see the
48.BR mkfs.xfs "(8) " -d
49.I file
50option).
51This might happen if an image copy of a filesystem has been made into
52an ordinary file with
53.BR xfs_copy (8).
54.TP
7f98455a
CH
55.B \-F
56Specifies that we want to continue even if the superblock magic is not
57correct. For use in
7f98455a
CH
58.BR xfs_metadump .
59.TP
2017d0d0
BN
60.B \-i
61Allows execution on a mounted filesystem, provided it is mounted read-only.
bfc541e7 62Useful for shell scripts
87342c3a 63which must only operate on filesystems in a guaranteed consistent state
2017d0d0
BN
64(either unmounted or mounted read-only). These semantics are slightly
65different to that of the
66.B -r
67option.
2bd0ea18 68.TP
2017d0d0
BN
69.BI \-l " logdev"
70Specifies the device where the filesystems external log resides.
71Only for those filesystems which use an external log. See the
72.BR mkfs.xfs "(8) " \-l
73option, and refer to
74.BR xfs (5)
cc01ba7a
NS
75for a detailed description of the XFS log.
76.TP
2017d0d0
BN
77.BI \-p " progname"
78Set the program name to
79.I progname
80for prompts and some error messages, the default value is
81.BR xfs_db .
82.TP
83.B -r
84Open
85.I device
86or
87.I filename
88read-only. This option is required if the filesystem is mounted.
2bd0ea18 89It is only necessary to omit this flag if a command that changes data
b64af2c4 90.RB ( write ", " blocktrash ", " crc )
2017d0d0 91is to be used.
2bd0ea18 92.TP
2017d0d0 93.B \-x
2bd0ea18 94Specifies expert mode.
2017d0d0 95This enables the
b64af2c4
ES
96.RB ( write ", " blocktrash ", " crc
97invalidate/revalidate) commands.
2017d0d0
BN
98.TP
99.B \-V
eaa6a2bf 100Prints the version number and exits.
2bd0ea18 101.SH CONCEPTS
2017d0d0
BN
102.B xfs_db
103commands can be broken up into two classes. Most commands are for
104the navigation and display of data structures in the filesystem.
2bd0ea18
NS
105Other commands are for scanning the filesystem in some way.
106.PP
107Commands which are used to navigate the filesystem structure take arguments
108which reflect the names of filesystem structure fields.
109There can be multiple field names separated by dots when the underlying
110structures are nested, as in C.
111The field names can be indexed (as an array index)
112if the underlying field is an array.
113The array indices can be specified as a range, two numbers separated by a dash.
114.PP
2017d0d0
BN
115.B xfs_db
116maintains a current address in the filesystem.
2bd0ea18
NS
117The granularity of the address is a filesystem structure.
118This can be a filesystem block,
119an inode or quota (smaller than a filesystem block),
120or a directory block (could be larger than a filesystem block).
121There are a variety of commands to set the current address.
122Associated with the current address is the current data type,
123which is the structural type of this data.
124Commands which follow the structure of the filesystem always set the type
125as well as the address.
126Commands which examine pieces of an individual file (inode) need the current
2017d0d0
BN
127inode to be set, this is done with the
128.B inode
129command.
2bd0ea18
NS
130.PP
131The current address/type information is actually maintained in a
132stack that can be explicitly manipulated with the
2017d0d0
BN
133.BR push ", " pop ", and " stack
134commands.
2bd0ea18
NS
135This allows for easy examination of a nested filesystem structure.
136Also, the last several locations visited are stored in a ring buffer
137which can be manipulated with the
2017d0d0
BN
138.BR forward ", " back ", and " ring
139commands.
2bd0ea18
NS
140.PP
141XFS filesystems are divided into a small number of allocation groups.
2017d0d0
BN
142.B xfs_db
143maintains a notion of the current allocation group which is
144manipulated by some commands. The initial allocation group is 0.
2bd0ea18
NS
145.SH COMMANDS
146.PP
2017d0d0
BN
147Many commands have extensive online help. Use the
148.B help
149command for more details on any command.
150.TP
151.B a
152See the
153.B addr
154command.
155.TP
156.BI ablock " filoff"
967d4e13
BN
157Set current address to the offset
158.I filoff
2017d0d0
BN
159(a filesystem block number) in the attribute area of the current inode.
160.TP
161.BI "addr [" field-expression ]
162Set current address to the value of the
163.IR field-expression .
164This is used to "follow" a reference in one structure to the object
967d4e13 165being referred to. If no argument is given, the current address is printed.
2017d0d0
BN
166.TP
167.BI "agf [" agno ]
168Set current address to the AGF block for allocation group
169.IR agno .
967d4e13 170If no argument is given, use the current allocation group.
2bd0ea18 171.TP
2017d0d0
BN
172.BI "agfl [" agno ]
173Set current address to the AGFL block for allocation group
174.IR agno .
967d4e13 175If no argument is given, use the current allocation group.
2bd0ea18 176.TP
2017d0d0
BN
177.BI "agi [" agno ]
178Set current address to the AGI block for allocation group
179.IR agno .
967d4e13 180If no argument is given, use the current allocation group.
2bd0ea18 181.TP
2017d0d0
BN
182.B b
183See the
184.B back
185command.
2bd0ea18 186.TP
2017d0d0 187.B back
2bd0ea18
NS
188Move to the previous location in the position ring.
189.TP
2017d0d0 190.B blockfree
2bd0ea18 191Free block usage information collected by the last execution of the
2017d0d0
BN
192.B blockget
193command. This must be done before another
194.B blockget
195command can be given, presumably with different arguments than the previous one.
2bd0ea18 196.TP
2017d0d0 197.BI "blockget [\-npvs] [\-b " bno "] ... [\-i " ino "] ..."
2bd0ea18
NS
198Get block usage and check filesystem consistency.
199The information is saved for use by a subsequent
2017d0d0 200.BR blockuse ", " ncheck ", or " blocktrash
bfc541e7 201command.
2017d0d0
BN
202.RS 1.0i
203.TP 0.4i
204.B \-b
205is used to specify filesystem block numbers about which verbose
206information should be printed.
207.TP
208.B \-i
209is used to specify inode numbers about which verbose information
210should be printed.
211.TP
212.B \-n
213is used to save pathnames for inodes visited, this is used to support the
214.BR xfs_ncheck (8)
215command. It also means that pathnames will be printed for inodes that have
216problems. This option uses a lot of memory so is not enabled by default.
217.TP
218.B \-p
219causes error messages to be prefixed with the filesystem name being
220processed. This is useful if several copies of
221.B xfs_db
222are run in parallel.
223.TP
224.B \-s
225restricts output to severe errors only. This is useful if the output is
226too long otherwise.
227.TP
228.B \-v
229enables verbose output. Messages will be printed for every block and
230inode processed.
231.RE
232.TP
37faa0da 233.BI "blocktrash [-z] [\-o " offset "] [\-n " count "] [\-x " min "] [\-y " max "] [\-s " seed "] [\-0|1|2|3] [\-t " type "] ..."
2bd0ea18
NS
234Trash randomly selected filesystem metadata blocks.
235Trashing occurs to randomly selected bits in the chosen blocks.
2017d0d0
BN
236This command is available only in debugging versions of
237.BR xfs_db .
238It is useful for testing
bfc541e7 239.BR xfs_repair "(8).
2017d0d0
BN
240.RS 1.0i
241.TP 0.4i
242.BR \-0 " | " -1 " | " -2 " | " -3
243These are used to set the operating mode for
244.BR blocktrash .
245Only one can be used:
246.B \-0
247changed bits are cleared;
248.B \-1
249changed bits are set;
250.B -2
251changed bits are inverted;
252.B -3
253changed bits are randomized.
254.TP
255.B \-n
256supplies the
257.I count
258of block-trashings to perform (default 1).
259.TP
37faa0da
DW
260.B \-o
261supplies the bit
262.I offset
263at which to start trashing the block. If the value is preceded by a '+', the
264trashing will start at a randomly chosen offset that is larger than the value
265supplied. The default is to randomly choose an offset anywhere in the block.
266.TP
2017d0d0
BN
267.B \-s
268supplies a
269.I seed
270to the random processing.
271.TP
272.B \-t
273gives a
274.I type
275of blocks to be selected for trashing. Multiple
276.B \-t
277options may be given. If no
278.B \-t
279options are given then all metadata types can be trashed.
280.TP
281.B \-x
282sets the
283.I minimum
284size of bit range to be trashed. The default value is 1.
285.TP
286.B \-y
287sets the
288.I maximum
289size of bit range to be trashed. The default value is 1024.
37faa0da
DW
290.TP
291.B \-z
292trashes the block at the top of the stack. It is not necessary to
293run
294.BI blockget
295if this option is supplied.
2017d0d0
BN
296.RE
297.TP
298.BI "blockuse [\-n] [\-c " count ]
2bd0ea18
NS
299Print usage for current filesystem block(s).
300For each block, the type and (if any) inode are printed.
2017d0d0
BN
301.RS 1.0i
302.TP 0.4i
303.B \-c
304specifies a
305.I count
306of blocks to process. The default value is 1 (the current block only).
307.TP
308.B \-n
309specifies that file names should be printed. The prior
310.B blockget
311command must have also specified the
312.B \-n
313option.
314.RE
2bd0ea18 315.TP
2e53a4f5 316.BI "bmap [\-a] [\-d] [" block " [" len ]]
2bd0ea18
NS
317Show the block map for the current inode.
318The map display can be restricted to an area of the file with the
2017d0d0
BN
319.I block
320and
321.I len
322arguments. If
323.I block
324is given and
325.I len
326is omitted then 1 is assumed for len.
327.IP
328The
329.B \-a
330and
331.B \-d
332options are used to select the attribute or data
2bd0ea18
NS
333area of the inode, if neither option is given then both areas are shown.
334.TP
21f0bffe
DW
335.B btdump [-a] [-i]
336If the cursor points to a btree node, dump the btree from that block downward.
337If instead the cursor points to an inode, dump the data fork block mapping btree if there is one.
a05feedb 338If the cursor points to a directory or extended attribute btree node, dump that.
21f0bffe
DW
339By default, only records stored in the btree are dumped.
340.RS 1.0i
341.TP 0.4i
342.B \-a
343If the cursor points at an inode, dump the extended attribute block mapping btree, if present.
344.TP
345.B \-i
346Dump all keys and pointers in intermediate btree nodes, and all records in leaf btree nodes.
347.RE
348.TP
2017d0d0
BN
349.B check
350See the
351.B blockget
352command.
2bd0ea18 353.TP
2017d0d0 354.BI "convert " "type number" " [" "type number" "] ... " type
2bd0ea18 355Convert from one address form to another.
2017d0d0
BN
356The known
357.IR type s,
358with alternate names, are:
359.RS 1.0i
360.PD 0
361.HP
362.B agblock
363or
364.B agbno
365(filesystem block within an allocation group)
366.HP
367.B agino
368or
369.B aginode
370(inode number within an allocation group)
371.HP
372.B agnumber
373or
374.B agno
375(allocation group number)
376.HP
377.B bboff
378or
379.B daddroff
380(byte offset in a
381.BR daddr )
382.HP
383.B blkoff
384or
385.B fsboff or
386.B agboff
387(byte offset in a
388.B agblock
389or
390.BR fsblock )
391.HP
392.B byte
393or
394.B fsbyte
395(byte address in filesystem)
396.HP
397.B daddr
398or
399.B bb
400(disk address, 512-byte blocks)
401.HP
402.B fsblock
403or
404.B fsb
405or
406.B fsbno
407(filesystem block, see the
408.B fsblock
409command)
410.HP
411.B ino
412or
413.B inode
414(inode number)
415.HP
416.B inoidx
417or
418.B offset
419(index of inode in filesystem block)
420.HP
421.B inooff
422or
423.B inodeoff
424(byte offset in inode)
425.PD
426.RE
427.IP
428Only conversions that "make sense" are allowed.
2bd0ea18
NS
429The compound form (with more than three arguments) is useful for
430conversions such as
2017d0d0
BN
431.B convert agno
432.I ag
433.B agbno
434.I agb
435.BR fsblock .
436.TP
b64af2c4
ES
437.B crc [\-i|\-r|\-v]
438Invalidates, revalidates, or validates the CRC (checksum)
439field of the current structure, if it has one.
440This command is available only on CRC-enabled filesystems.
441With no argument, validation is performed.
442Each command will display the resulting CRC value and state.
443.RS 1.0i
444.TP 0.4i
445.B \-i
446Invalidate the structure's CRC value (incrementing it by one),
447and write it to disk.
448.TP
449.B \-r
450Recalculate the current structure's correct CRC value, and write it to disk.
451.TP
452.B \-v
453Validate and display the current value and state of the structure's CRC.
454.RE
455.TP
2017d0d0
BN
456.BI "daddr [" d ]
457Set current address to the daddr (512 byte block) given by
458.IR d .
459If no value for
460.I d
967d4e13
BN
461is given, the current address is printed, expressed as a daddr.
462The type is set to
2017d0d0
BN
463.B data
464(uninterpreted).
465.TP
466.BI dblock " filoff"
467Set current address to the offset
468.I filoff
469(a filesystem block number) in the data area of the current inode.
470.TP
471.BI "debug [" flagbits ]
472Set debug option bits. These are used for debugging
473.BR xfs_db .
474If no value is given for
475.IR flagbits ,
476print the current debug option bits. These are for the use of the implementor.
477.TP
fa247a5b
ES
478.BI "dquot [" \-g | \-p | \-u ] " id"
479Set current address to a group, project or user quota block for the given ID. Defaults to user quota.
2bd0ea18 480.TP
2017d0d0 481.BI "echo [" arg "] ..."
2bd0ea18
NS
482Echo the arguments to the output.
483.TP
2017d0d0
BN
484.B f
485See the
486.B forward
487command.
2bd0ea18 488.TP
2017d0d0 489.B forward
2bd0ea18
NS
490Move forward to the next entry in the position ring.
491.TP
2017d0d0
BN
492.B frag [\-adflqRrv]
493Get file fragmentation data. This prints information about fragmentation
494of file data in the filesystem (as opposed to fragmentation of freespace,
495for which see the
496.B freesp
497command). Every file in the filesystem is examined to see how far from ideal
498its extent mappings are. A summary is printed giving the totals.
499.RS 1.0i
500.TP 0.4i
501.B \-v
502sets verbosity, every inode has information printed for it.
2bd0ea18
NS
503The remaining options select which inodes and extents are examined.
504If no options are given then all are assumed set,
505otherwise just those given are enabled.
2bd0ea18 506.TP
2017d0d0
BN
507.B \-a
508enables processing of attribute data.
509.TP
510.B \-d
511enables processing of directory data.
512.TP
513.B \-f
514enables processing of regular file data.
515.TP
516.B \-l
517enables processing of symbolic link data.
518.TP
519.B \-q
520enables processing of quota file data.
521.TP
522.B \-R
523enables processing of realtime control file data.
524.TP
525.B \-r
526enables processing of realtime file data.
527.RE
528.TP
732f8f5a 529.BI "freesp [\-bcds] [\-A " alignment "] [\-a " ag "] ... [\-e " i "] [\-h " h1 "] ... [\-m " m ]
2017d0d0
BN
530Summarize free space for the filesystem. The free blocks are examined
531and totalled, and displayed in the form of a histogram, with a count
532of extents in each range of free extent sizes.
533.RS 1.0i
534.TP 0.4i
732f8f5a
ES
535.B \-A
536reports only free extents with starting blocks aligned to
537.I alignment
538blocks.
539.TP
2017d0d0
BN
540.B \-a
541adds
542.I ag
543to the list of allocation groups to be processed. If no
544.B \-a
545options are given then all allocation groups are processed.
546.TP
547.B \-b
548specifies that the histogram buckets are binary-sized, with the starting
549sizes being the powers of 2.
550.TP
551.B \-c
552specifies that
553.B freesp
554will search the by-size (cnt) space Btree instead of the default
555by-block (bno) space Btree.
556.TP
557.B \-d
558specifies that every free extent will be displayed.
559.TP
560.B \-e
561specifies that the histogram buckets are
562equal-sized, with the size specified as
563.IR i .
564.TP
565.B \-h
566specifies a starting block number for a histogram bucket as
567.IR h1 .
568Multiple
569.BR \-h 's
570are given to specify the complete set of buckets.
571.TP
572.B \-m
573specifies that the histogram starting block numbers are powers of
574.IR m .
575This is the general case of
576.BR \-b .
577.TP
578.B \-s
579specifies that a final summary of total free extents,
2bd0ea18 580free blocks, and the average free extent size is printed.
2017d0d0 581.RE
2bd0ea18 582.TP
2017d0d0
BN
583.B fsb
584See the
585.B fsblock
586command.
587.TP
588.BI "fsblock [" fsb ]
589Set current address to the fsblock value given by
590.IR fsb .
591If no value for
592.I fsb
593is given the current address is printed, expressed as an fsb.
594The type is set to
595.B data
596(uninterpreted). XFS filesystem block numbers are computed
597.RI (( agno " << " agshift ") | " agblock )
598where
599.I agshift
600depends on the size of an allocation group. Use the
601.B convert
602command to convert to and from this form. Block numbers given for file blocks
603(for instance from the
604.B bmap
605command) are in this form.
606.TP
86bb49e4
DW
607.BI "fsmap [ " start " ] [ " end " ]
608Prints the mapping of disk blocks used by an XFS filesystem. The map
609lists each extent used by files, allocation group metadata,
610journalling logs, and static filesystem metadata, as well as any
611regions that are unused. All blocks, offsets, and lengths are specified
612in units of 512-byte blocks, no matter what the filesystem's block size is.
613.BI "The optional " start " and " end " arguments can be used to constrain
614the output to a particular range of disk blocks.
615.TP
2017d0d0
BN
616.BI hash " string
617Prints the hash value of
618.I string
619using the hash function of the XFS directory and attribute implementation.
620.TP
621.BI "help [" command ]
2bd0ea18
NS
622Print help for one or all commands.
623.TP
2017d0d0
BN
624.BI "inode [" inode# ]
625Set the current inode number. If no
626.I inode#
627is given, print the current inode number.
2bd0ea18 628.TP
2017d0d0
BN
629.BI "label [" label ]
630Set the filesystem label. The filesystem label can be used by
631.BR mount (8)
512cfb8a
NS
632instead of using a device special file.
633The maximum length of an XFS label is 12 characters \- use of a longer
2017d0d0
BN
634.I label
635will result in truncation and a warning will be issued. If no
636.I label
637is given, the current filesystem label is printed.
512cfb8a 638.TP
2017d0d0
BN
639.BI "log [stop | start " filename ]
640Start logging output to
641.IR filename ,
642stop logging, or print the current logging status.
2bd0ea18 643.TP
2017d0d0 644.BI "metadump [\-egow] " filename
61983f67 645Dumps metadata to a file. See
2017d0d0
BN
646.BR xfs_metadump (8)
647for more information.
648.TP
649.BI "ncheck [\-s] [\-i " ino "] ..."
650Print name-inode pairs. A
651.B blockget \-n
652command must be run first to gather the information.
653.RS 1.0i
654.TP 0.4i
655.B \-i
656specifies an inode number to be printed. If no
657.B \-i
658options are given then all inodes are printed.
659.TP
660.B \-s
661specifies that only setuid and setgid files are printed.
662.RE
663.TP
664.B p
665See the
666.B print
667command.
2bd0ea18 668.TP
2017d0d0 669.B pop
2bd0ea18
NS
670Pop location from the stack.
671.TP
2017d0d0 672.BI "print [" field-expression "] ..."
2bd0ea18
NS
673Print field values.
674If no argument is given, print all fields in the current structure.
675.TP
2017d0d0
BN
676.BI "push [" command ]
677Push location to the stack. If
678.I command
679is supplied, set the current location to the results of
680.I command
2bd0ea18
NS
681after pushing the old location.
682.TP
2017d0d0
BN
683.B q
684See the
685.B quit
686command.
687.TP
688.B quit
689Exit
690.BR xfs_db .
691.TP
692.BI "ring [" index ]
693Show position ring (if no
694.I index
695argument is given), or move to a specific entry in the position ring given by
696.IR index .
697.TP
698.BI "sb [" agno ]
699Set current address to SB header in allocation group
700.IR agno .
701If no
702.I agno
967d4e13 703is given, use the current allocation group number.
2017d0d0
BN
704.TP
705.BI "source " source-file
706Process commands from
707.IR source-file .
708.B source
709commands can be nested.
710.TP
711.B stack
2bd0ea18
NS
712View the location stack.
713.TP
2017d0d0
BN
714.BI "type [" type ]
715Set the current data type to
716.IR type .
2bd0ea18
NS
717If no argument is given, show the current data type.
718The possible data types are:
2017d0d0
BN
719.BR agf ", " agfl ", " agi ", " attr ", " bmapbta ", " bmapbtd ,
720.BR bnobt ", " cntbt ", " data ", " dir ", " dir2 ", " dqblk ,
9fb2cb27
DW
721.BR inobt ", " inode ", " log ", " refcntbt ", " rmapbt ", " rtbitmap ,
722.BR rtsummary ", " sb ", " symlink " and " text .
2bd0ea18
NS
723See the TYPES section below for more information on these data types.
724.TP
9c4e12fb 725.BI "uuid [" uuid " | " generate " | " rewrite " | " restore ]
512cfb8a
NS
726Set the filesystem universally unique identifier (UUID).
727The filesystem UUID can be used by
2017d0d0 728.BR mount (8)
512cfb8a 729instead of using a device special file.
2017d0d0
BN
730The
731.I uuid
732can be set directly to the desired UUID, or it can
733be automatically generated using the
734.B generate
735option. These options will both write the UUID into every copy of the
9c4e12fb
ES
736superblock in the filesystem. On a CRC-enabled filesystem, this will
737set an incompatible superblock flag, and the filesystem will not be
738mountable with older kernels. This can be reverted with the
739.B restore
740option, which will copy the original UUID back into place and clear
741the incompatible flag as needed.
2017d0d0
BN
742.B rewrite
743copies the current UUID from the primary superblock
512cfb8a
NS
744to all secondary copies of the superblock.
745If no argument is given, the current filesystem UUID is printed.
746.TP
2017d0d0 747.BI "version [" feature " | " "versionnum features2" ]
4ca431fc
NS
748Enable selected features for a filesystem (certain features can
749be enabled on an unmounted filesystem, after
2017d0d0 750.BR mkfs.xfs (8)
4ca431fc 751has created the filesystem).
2017d0d0
BN
752Support for unwritten extents can be enabled using the
753.B extflg
754option. Support for version 2 log format can be enabled using the
755.B log2
756option. Support for extended attributes can be enabled using the
757.B attr1
758or
759.B attr2
760option. Once enabled, extended attributes cannot be disabled, but the user
761may toggle between
762.B attr1
763and
764.B attr2
765at will (older kernels may not support the newer version).
766.IP
767If no argument is given, the current version and feature bits are printed.
d2df702b
NS
768With one argument, this command will write the updated version number
769into every copy of the superblock in the filesystem.
d2df702b 770If two arguments are given, they will be used as numeric values for the
2017d0d0
BN
771.I versionnum
772and
773.I features2
774bits respectively, and their string equivalent reported
775(but no modifications are made).
4ca431fc 776.TP
ca138928 777.BI "write [\-c] [\-d] [" "field value" "] ..."
2bd0ea18
NS
778Write a value to disk.
779Specific fields can be set in structures (struct mode),
780or a block can be set to data values (data mode),
781or a block can be set to string values (string mode, for symlink blocks).
782The operation happens immediately: there is no buffering.
2017d0d0 783.IP
2bd0ea18 784Struct mode is in effect when the current type is structural,
2017d0d0
BN
785i.e. not data. For struct mode, the syntax is "\c
786.B write
787.I field value\c
788".
789.IP
790Data mode is in effect when the current type is data. In this case the
791contents of the block can be shifted or rotated left or right, or filled
792with a sequence, a constant value, or a random value. In this mode
793.B write
794with no arguments gives more information on the allowed commands.
c9f5e3db
ES
795.RS 1.0i
796.TP 0.4i
797.B \-c
798Skip write verifiers and CRC recalculation; allows invalid data to be written
799to disk.
ca138928
DW
800.TP 0.4i
801.B \-d
802Skip write verifiers but perform CRC recalculation.
803This allows invalid data to be written to disk to
804test detection of invalid data. (This is not possible for some types.)
c9f5e3db 805.RE
2bd0ea18
NS
806.SH TYPES
807This section gives the fields in each structure type and their meanings.
808Note that some types of block cover multiple actual structures,
809for instance directory blocks.
2017d0d0
BN
810.TP 1.0i
811.B agf
2bd0ea18
NS
812The AGF block is the header for block allocation information;
813it is in the second 512-byte block of each allocation group.
814The following fields are defined:
2017d0d0
BN
815.RS 1.4i
816.PD 0
817.TP 1.2i
818.B magicnum
819AGF block magic number, 0x58414746 ('XAGF').
820.TP
821.B versionnum
822version number, currently 1.
823.TP
824.B seqno
825sequence number starting from 0.
826.TP
827.B length
828size in filesystem blocks of the allocation group. All allocation
829groups except the last one of the filesystem have the superblock's
830.B agblocks
831value here.
832.TP
833.B bnoroot
834block number of the root of the Btree holding free space
835information sorted by block number.
2bd0ea18 836.TP
2017d0d0
BN
837.B cntroot
838block number of the root of the Btree holding free space
839information sorted by block count.
840.TP
841.B bnolevel
842number of levels in the by-block-number Btree.
843.TP
844.B cntlevel
845number of levels in the by-block-count Btree.
846.TP
847.B flfirst
848index into the AGFL block of the first active entry.
849.TP
850.B fllast
851index into the AGFL block of the last active entry.
852.TP
853.B flcount
854count of active entries in the AGFL block.
855.TP
856.B freeblks
857count of blocks represented in the freespace Btrees.
858.TP
859.B longest
860longest free space represented in the freespace Btrees.
861.TP
862.B btreeblks
863number of blocks held in the AGF Btrees.
864.PD
865.RE
866.TP
967d4e13 867.B agfl
2bd0ea18
NS
868The AGFL block contains block numbers for use of the block allocator;
869it is in the fourth 512-byte block of each allocation group.
870Each entry in the active list is a block number within the allocation group
871that can be used for any purpose if space runs low.
2017d0d0
BN
872The AGF block fields
873.BR flfirst ", " fllast ", and " flcount
2bd0ea18
NS
874designate which entries are currently active.
875Entry space is allocated in a circular manner within the AGFL block.
876Fields defined:
2017d0d0
BN
877.RS 1.4i
878.PD 0
879.TP 1.2i
880.B bno
881array of all block numbers. Even those which are not active are printed.
882.PD
883.RE
884.TP
885.B agi
2bd0ea18
NS
886The AGI block is the header for inode allocation information;
887it is in the third 512-byte block of each allocation group.
888Fields defined:
2017d0d0
BN
889.RS 1.4i
890.PD 0
891.TP 1.2i
892.B magicnum
893AGI block magic number, 0x58414749 ('XAGI').
894.TP
895.B versionnum
896version number, currently 1.
897.TP
898.B seqno
899sequence number starting from 0.
900.TP
901.B length
902size in filesystem blocks of the allocation group.
903.TP
904.B count
905count of inodes allocated.
906.TP
907.B root
908block number of the root of the Btree holding inode allocation information.
909.TP
910.B level
911number of levels in the inode allocation Btree.
912.TP
913.B freecount
914count of allocated inodes that are not in use.
915.TP
916.B newino
917last inode number allocated.
918.TP
919.B dirino
920unused.
921.TP
922.B unlinked
923an array of inode numbers within the allocation group. The entries
924in the AGI block are the heads of lists which run through the inode
925.B next_unlinked
926field. These inodes are to be unlinked the next time the filesystem is mounted.
927.PD
928.RE
929.TP
930.B attr
931An attribute fork is organized as a Btree with the actual data embedded
932in the leaf blocks. The root of the Btree is found in block 0 of the fork.
2bd0ea18 933The index (sort order) of the Btree is the hash value of the attribute name.
2017d0d0
BN
934All the blocks contain a
935.B blkinfo
936structure at the beginning, see type
937.B dir
938for a description. Nonleaf blocks are identical in format to those for
939version 1 and version 2 directories, see type
940.B dir
941for a description. Leaf blocks can refer to "local" or "remote" attribute
942values. Local values are stored directly in the leaf block.
29b90b5b 943Leaf blocks contain the following fields:
2017d0d0
BN
944.RS 1.4i
945.PD 0
946.TP 1.2i
947.B hdr
948header containing a
949.B blkinfo
950structure
951.B info
952(magic number 0xfbee), a
953.B count
954of active entries,
955.B usedbytes
956total bytes of names and values, the
957.B firstused
958byte in the name area,
959.B holes
960set if the block needs compaction, and array
961.B freemap
962as for
963.B dir
964leaf blocks.
965.TP
966.B entries
967array of structures containing a
968.BR hashval ,
969.B nameidx
970(index into the block of the name), and flags
971.BR incomplete ,
972.BR root ,
973and
974.BR local .
975.TP
976.B nvlist
977array of structures describing the attribute names and values. Fields
978always present:
979.B valuelen
980(length of value in bytes),
981.BR namelen ,
982and
983.BR name .
2bd0ea18 984Fields present for local values:
2017d0d0
BN
985.B value
986(value string). Fields present for remote values:
987.B valueblk
988(fork block number of containing the value).
989.PD
990.RE
29b90b5b
DW
991.IP
992Remote values are stored in an independent block in the attribute fork.
993Prior to v5, value blocks had no structure, but in v5 they acquired a header
994structure with the following fields:
995.RS 1.4i
996.PD 0
997.TP 1.2i
998.B magic
999attr3 remote block magic number, 0x5841524d ('XARM').
1000.TP
1001.B offset
1002Byte offset of this data block within the overall attribute value.
1003.TP
1004.B bytes
1005Number of bytes stored in this block.
1006.TP
1007.B crc
1008Checksum of the attribute block contents.
1009.TP
1010.B uuid
1011Filesystem UUID.
1012.TP
1013.B owner
1014Inode that owns this attribute value.
1015.TP
1016.B bno
1017Block offset of this block within the inode's attribute fork.
1018.TP
1019.B lsn
1020Log serial number of the last time this block was logged.
1021.TP
1022.B data
1023The attribute value data.
1024.PD
1025.RE
2017d0d0
BN
1026.TP
1027.B bmapbt
2bd0ea18
NS
1028Files with many extents in their data or attribute fork will have the
1029extents described by the contents of a Btree for that fork,
1030instead of being stored directly in the inode.
1031Each bmap Btree starts with a root block contained within the inode.
1032The other levels of the Btree are stored in filesystem blocks.
1033The blocks are linked to sibling left and right blocks at each level,
1034as well as by pointers from parent to child blocks.
1035Each block contains the following fields:
2017d0d0
BN
1036.RS 1.4i
1037.PD 0
1038.TP 1.2i
1039.B magic
1040bmap Btree block magic number, 0x424d4150 ('BMAP').
1041.TP
1042.B level
1043level of this block above the leaf level.
1044.TP
1045.B numrecs
1046number of records or keys in the block.
1047.TP
1048.B leftsib
1049left (logically lower) sibling block, 0 if none.
1050.TP
1051.B rightsib
1052right (logically higher) sibling block, 0 if none.
1053.TP
1054.B recs
1055[leaf blocks only] array of extent records.
d2df702b 1056Each record contains
2017d0d0
BN
1057.BR startoff ,
1058.BR startblock ,
1059.BR blockcount ,
1060and
1061.B extentflag
1062(1 if the extent is unwritten).
1063.TP
1064.B keys
87342c3a 1065[non-leaf blocks only] array of key records. These are the first key
2017d0d0
BN
1066value of each block in the level below this one. Each record contains
1067.BR startoff .
1068.TP
1069.B ptrs
87342c3a 1070[non-leaf blocks only] array of child block pointers.
2017d0d0
BN
1071Each pointer is a filesystem block number to the next level in the Btree.
1072.PD
1073.RE
1074.TP
1075.B bnobt
1076There is one set of filesystem blocks forming the by-block-number
1077allocation Btree for each allocation group. The root block of this
1078Btree is designated by the
1079.B bnoroot
87342c3a 1080field in the corresponding AGF block.
2bd0ea18
NS
1081The blocks are linked to sibling left and right blocks at each level,
1082as well as by pointers from parent to child blocks.
1083Each block has the following fields:
2017d0d0
BN
1084.RS 1.4i
1085.PD 0
1086.TP 1.2i
1087.B magic
1088BNOBT block magic number, 0x41425442 ('ABTB').
1089.TP
1090.B level
1091level number of this block, 0 is a leaf.
1092.TP
1093.B numrecs
1094number of data entries in the block.
1095.TP
1096.B leftsib
1097left (logically lower) sibling block, 0 if none.
1098.TP
1099.B rightsib
1100right (logically higher) sibling block, 0 if none.
1101.TP
1102.B recs
1103[leaf blocks only] array of freespace records. Each record contains
1104.B startblock
1105and
1106.BR blockcount .
1107.TP
1108.B keys
87342c3a 1109[non-leaf blocks only] array of key records. These are the first value
2017d0d0
BN
1110of each block in the level below this one. Each record contains
1111.B startblock
1112and
1113.BR blockcount .
1114.TP
1115.B ptrs
87342c3a 1116[non-leaf blocks only] array of child block pointers. Each pointer is a
2017d0d0
BN
1117block number within the allocation group to the next level in the Btree.
1118.PD
1119.RE
1120.TP
1121.B cntbt
1122There is one set of filesystem blocks forming the by-block-count
1123allocation Btree for each allocation group. The root block of this
1124Btree is designated by the
1125.B cntroot
87342c3a 1126field in the corresponding AGF block. The blocks are linked to sibling
2017d0d0
BN
1127left and right blocks at each level, as well as by pointers from parent
1128to child blocks. Each block has the following fields:
1129.RS 1.4i
1130.PD 0
1131.TP 1.2i
1132.B magic
1133CNTBT block magic number, 0x41425443 ('ABTC').
1134.TP
1135.B level
1136level number of this block, 0 is a leaf.
1137.TP
1138.B numrecs
1139number of data entries in the block.
1140.TP
1141.B leftsib
1142left (logically lower) sibling block, 0 if none.
1143.TP
1144.B rightsib
1145right (logically higher) sibling block, 0 if none.
1146.TP
1147.B recs
1148[leaf blocks only] array of freespace records. Each record contains
1149.B startblock
1150and
1151.BR blockcount .
1152.TP
1153.B keys
87342c3a 1154[non-leaf blocks only] array of key records. These are the first value
2017d0d0
BN
1155of each block in the level below this one. Each record contains
1156.B blockcount
1157and
1158.BR startblock .
1159.TP
1160.B ptrs
87342c3a 1161[non-leaf blocks only] array of child block pointers. Each pointer is a
2017d0d0
BN
1162block number within the allocation group to the next level in the Btree.
1163.PD
1164.RE
1165.TP
1166.B data
1167User file blocks, and other blocks whose type is unknown, have this
1168type for display purposes in
1169.BR xfs_db .
2bd0ea18
NS
1170The block data is displayed in hexadecimal format.
1171.TP
2017d0d0 1172.B dir
2bd0ea18 1173A version 1 directory is organized as a Btree with the directory data
2017d0d0
BN
1174embedded in the leaf blocks. The root of the Btree is found in block 0
1175of the file. The index (sort order) of the Btree is the hash value of
1176the entry name. All the blocks contain a
1177.B blkinfo
1178structure at the beginning with the following fields:
1179.RS 1.4i
1180.PD 0
1181.TP 1.2i
1182.B forw
1183next sibling block.
1184.TP
1185.B back
1186previous sibling block.
1187.TP
1188.B magic
1189magic number for this block type.
1190.RE
1191.IP
1192
1193The non-leaf (node) blocks have the following fields:
1194.RS 1.4i
1195.TP 1.2i
1196.B hdr
1197header containing a
1198.B blkinfo
1199structure
1200.B info
1201(magic number 0xfebe), the
1202.B count
1203of active entries, and the
1204.B level
1205of this block above the leaves.
1206.TP
1207.B btree
1208array of entries containing
1209.B hashval
1210and
1211.B before
1212fields. The
1213.B before
1214value is a block number within the directory file to the child block, the
1215.B hashval
1216is the last hash value in that block.
1217.RE
1218.IP
1219
2bd0ea18 1220The leaf blocks have the following fields:
2017d0d0
BN
1221.RS 1.4i
1222.TP 1.2i
1223.B hdr
1224header containing a
1225.B blkinfo
1226structure
1227.B info
1228(magic number 0xfeeb), the
1229.B count
1230of active entries,
1231.B namebytes
1232(total name string bytes),
1233.B holes
1234flag (block needs compaction), and
1235.B freemap
1236(array of
1237.BR base ", " size
1238entries for free regions).
1239.TP
1240.B entries
1241array of structures containing
1242.BR hashval ,
1243.B nameidx
1244(byte index into the block of the name string), and
1245.BR namelen .
1246.TP
1247.B namelist
1248array of structures containing
1249.B inumber
1250and
1251.BR name .
1252.RE
1253.PD
1254.TP
1255.B dir2
2bd0ea18
NS
1256A version 2 directory has four kinds of blocks.
1257Data blocks start at offset 0 in the file.
1258There are two kinds of data blocks: single-block directories have
1259the leaf information embedded at the end of the block, data blocks
1260in multi-block directories do not.
062998e3 1261Node and leaf blocks start at offset 32GiB (with either a single
2bd0ea18 1262leaf block or the root node block).
062998e3 1263Freespace blocks start at offset 64GiB.
2bd0ea18
NS
1264The node and leaf blocks form a Btree, with references to the data
1265in the data blocks.
1266The freespace blocks form an index of longest free spaces within the
1267data blocks.
2017d0d0 1268.IP
2bd0ea18 1269A single-block directory block contains the following fields:
2017d0d0
BN
1270.RS 1.4i
1271.PD 0
1272.TP 1.2i
1273.B bhdr
1274header containing
1275.B magic
1276number 0x58443242 ('XD2B') and an array
1277.B bestfree
1278of the longest 3 free spaces in the block
1279.RB ( offset ", " length ).
1280.TP
1281.B bu
1282array of union structures. Each element is either an entry or a freespace.
2bd0ea18 1283For entries, there are the following fields:
2017d0d0
BN
1284.BR inumber ,
1285.BR namelen ,
1286.BR name ,
1287and
1288.BR tag .
2bd0ea18 1289For freespace, there are the following fields:
2017d0d0
BN
1290.B freetag
1291(0xffff),
1292.BR length ,
1293and
1294.BR tag .
1295The
1296.B tag
1297value is the byte offset in the block of the start of the entry it
1298is contained in.
1299.TP
1300.B bleaf
1301array of leaf entries containing
1302.B hashval
1303and
1304.BR address .
1305The
1306.B address
1307is a 64-bit word offset into the file.
1308.TP
1309.B btail
1310tail structure containing the total
1311.B count
1312of leaf entries and
1313.B stale
1314count of unused leaf entries.
1315.RE
1316.IP
1317
2bd0ea18 1318A data block contains the following fields:
2017d0d0
BN
1319.RS 1.4i
1320.TP 1.2i
1321.B dhdr
d2df702b 1322header containing
2017d0d0
BN
1323.B magic
1324number 0x58443244 ('XD2D') and an array
1325.B bestfree
1326of the longest 3 free spaces in the block
1327.RB ( offset ", " length ).
1328.TP
1329.B du
1330array of union structures as for
1331.BR bu .
1332.RE
1333.IP
1334
1335Leaf blocks have two possible forms. If the Btree consists of a single
1336leaf then the freespace information is in the leaf block,
2bd0ea18 1337otherwise it is in separate blocks and the root of the Btree is
2017d0d0
BN
1338a node block. A leaf block contains the following fields:
1339.RS 1.4i
1340.TP 1.2i
1341.B lhdr
1342header containing a
1343.B blkinfo
1344structure
1345.B info
1346(magic number 0xd2f1 for the single leaf case, 0xd2ff for the true
1347Btree case), the total
1348.B count
1349of leaf entries, and
1350.B stale
1351count of unused leaf entries.
1352.TP
1353.B lents
1354leaf entries, as for
1355.BR bleaf .
1356.TP
1357.B lbests
1358[single leaf only] array of values which represent the longest freespace
1359in each data block in the directory.
1360.TP
1361.B ltail
1362[single leaf only] tail structure containing
1363.B bestcount
1364count of
1365.BR lbests .
1366.RE
1367.IP
1368
1369A node block is identical to that for types
1370.B attr
1371and
1372.BR dir .
1373
2bd0ea18 1374A freespace block contains the following fields:
2017d0d0
BN
1375.RS 1.4i
1376.TP 1.2i
1377.B fhdr
1378header containing
1379.B magic
1380number 0x58443246 ('XD2F'),
1381.B firstdb
1382first data block number covered by this freespace block,
1383.B nvalid
1384number of valid entries, and
1385.B nused
1386number of entries representing real data blocks.
1387.TP
1388.B fbests
1389array of values as for
1390.BR lbests .
1391.PD
1392.RE
1393.TP
1394.B dqblk
2bd0ea18 1395The quota information is stored in files referred to by the superblock
2017d0d0
BN
1396.B uquotino
1397and
1398.B pquotino
1399fields. Each filesystem block in a quota file contains a constant number of
1400quota entries. The quota entry size is currently 136 bytes, so with a 4KiB
1401filesystem block size there are 30 quota entries per block. The
1402.B dquot
1403command is used to locate these entries in the filesystem.
2bd0ea18
NS
1404The file entries are indexed by the user or project identifier
1405to determine the block and offset.
1406Each quota entry has the following fields:
2017d0d0
BN
1407.RS 1.4i
1408.PD 0
1409.TP 1.5i
1410.B magic
1411magic number, 0x4451 ('DQ').
1412.TP
1413.B version
1414version number, currently 1.
1415.TP
1416.B flags
1417flags, values include 0x01 for user quota, 0x02 for project quota.
1418.TP
1419.B id
1420user or project identifier.
1421.TP
1422.B blk_hardlimit
1423absolute limit on blocks in use.
1424.TP
1425.B blk_softlimit
1426preferred limit on blocks in use.
1427.TP
1428.B ino_hardlimit
1429absolute limit on inodes in use.
1430.TP
1431.B ino_softlimit
1432preferred limit on inodes in use.
1433.TP
1434.B bcount
1435blocks actually in use.
1436.TP
1437.B icount
1438inodes actually in use.
1439.TP
1440.B itimer
1441time when service will be refused if soft limit is violated for inodes.
1442.TP
1443.B btimer
1444time when service will be refused if soft limit is violated for blocks.
1445.TP
1446.B iwarns
1447number of warnings issued about inode limit violations.
1448.TP
1449.B bwarns
1450number of warnings issued about block limit violations.
1451.TP
1452.B rtb_hardlimit
1453absolute limit on realtime blocks in use.
1454.TP
1455.B rtb_softlimit
1456preferred limit on realtime blocks in use.
1457.TP
1458.B rtbcount
1459realtime blocks actually in use.
2bd0ea18 1460.TP
2017d0d0
BN
1461.B rtbtimer
1462time when service will be refused if soft limit is violated for realtime blocks.
1463.TP
1464.B rtbwarns
1465number of warnings issued about realtime block limit violations.
1466.PD
1467.RE
1468.TP
1469.B inobt
1470There is one set of filesystem blocks forming the inode allocation Btree for
1471each allocation group. The root block of this Btree is designated by the
1472.B root
87342c3a 1473field in the corresponding AGI block.
2bd0ea18
NS
1474The blocks are linked to sibling left and right blocks at each level,
1475as well as by pointers from parent to child blocks.
1476Each block has the following fields:
2017d0d0
BN
1477.RS 1.4i
1478.PD 0
1479.TP 1.2i
1480.B magic
1481INOBT block magic number, 0x49414254 ('IABT').
1482.TP
1483.B level
1484level number of this block, 0 is a leaf.
1485.TP
1486.B numrecs
1487number of data entries in the block.
1488.TP
1489.B leftsib
1490left (logically lower) sibling block, 0 if none.
1491.TP
1492.B rightsib
1493right (logically higher) sibling block, 0 if none.
1494.TP
1495.B recs
1496[leaf blocks only] array of inode records. Each record contains
1497.B startino
1498allocation-group relative inode number,
1499.B freecount
1500count of free inodes in this chunk, and
1501.B free
1502bitmap, LSB corresponds to inode 0.
1503.TP
1504.B keys
87342c3a 1505[non-leaf blocks only] array of key records. These are the first value of each
2017d0d0
BN
1506block in the level below this one. Each record contains
1507.BR startino .
1508.TP
1509.B ptrs
87342c3a 1510[non-leaf blocks only] array of child block pointers. Each pointer is a
2017d0d0
BN
1511block number within the allocation group to the next level in the Btree.
1512.PD
1513.RE
1514.TP
1515.B inode
1516Inodes are allocated in "chunks" of 64 inodes each. Usually a chunk is
1517multiple filesystem blocks, although there are cases with large filesystem
1518blocks where a chunk is less than one block. The inode Btree (see
1519.B inobt
1520above) refers to the inode numbers per allocation group. The inode numbers
1521directly reflect the location of the inode block on disk. Use the
1522.B inode
1523command to point
1524.B xfs_db
1525to a specific inode. Each inode contains four regions:
1526.BR core ,
1527.BR next_unlinked ,
1528.BR u ", and "
1529.BR a .
1530.B core
1531contains the fixed information.
1532.B next_unlinked
1533is separated from the core due to journaling considerations, see type
1534.B agi
1535field
1536.BR unlinked .
1537.B u
1538is a union structure that is different in size and format depending
1539on the type and representation of the file data ("data fork").
1540.B a
1541is an optional union structure to describe attribute data,
2bd0ea18 1542that is different in size, format, and location depending on the presence
2017d0d0
BN
1543and representation of attribute data, and the size of the
1544.B u
1545data ("attribute fork").
1546.B xfs_db
1547automatically selects the proper union members based on information
1548in the inode.
1549.IP
2bd0ea18 1550The following are fields in the inode core:
2017d0d0
BN
1551.RS 1.4i
1552.PD 0
1553.TP 1.2i
1554.B magic
1555inode magic number, 0x494e ('IN').
2bd0ea18 1556.TP
2017d0d0
BN
1557.B mode
1558mode and type of file, as described in
1559.BR chmod (2),
1560.BR mknod (2),
1561and
1562.BR stat (2).
1563.TP
1564.B version
1565inode version, 1 or 2.
1566.TP
1567.B format
1568format of
1569.B u
1570union data (0: xfs_dev_t, 1: local file \- in-inode directory or symlink,
15712: extent list, 3: Btree root, 4: unique id [unused]).
1572.TP
1573.B nlinkv1
1574number of links to the file in a version 1 inode.
1575.TP
1576.B nlinkv2
1577number of links to the file in a version 2 inode.
1578.TP
22bc10ed
AM
1579.B projid_lo
1580owner's project id (low word; version 2 inode only).
1581.B projid_hi
1582owner's project id (high word; version 2 inode only).
2017d0d0
BN
1583.TP
1584.B uid
1585owner's user id.
1586.TP
1587.B gid
1588owner's group id.
1589.TP
1590.B atime
1591time last accessed (seconds and nanoseconds).
1592.TP
1593.B mtime
1594time last modified.
1595.TP
1596.B ctime
1597time created or inode last modified.
1598.TP
1599.B size
1600number of bytes in the file.
1601.TP
1602.B nblocks
1603total number of blocks in the file including indirect and attribute.
1604.TP
1605.B extsize
1606basic/minimum extent size for the file.
1607.TP
1608.B nextents
1609number of extents in the data fork.
1610.TP
1611.B naextents
1612number of extents in the attribute fork.
1613.TP
1614.B forkoff
1615attribute fork offset in the inode, in 64-bit words from the start of
1616.BR u .
1617.TP
1618.B aformat
1619format of
1620.B a
1621data (1: local attribute data, 2: extent list, 3: Btree root).
1622.TP
1623.B dmevmask
1624DMAPI event mask.
1625.TP
1626.B dmstate
1627DMAPI state information.
1628.TP
1629.B newrtbm
1630file is the realtime bitmap and is "new" format.
1631.TP
1632.B prealloc
1633file has preallocated data space after EOF.
1634.TP
1635.B realtime
1636file data is in the realtime subvolume.
1637.TP
1638.B gen
1639inode generation number.
1640.RE
1641.IP
1642
1643The following fields are in the
1644.B u
1645data fork union:
1646.RS 1.4i
1647.TP 1.2i
1648.B bmbt
1649bmap Btree root. This looks like a
1650.B bmapbtd
1651block with redundant information removed.
1652.TP
1653.B bmx
1654array of extent descriptors.
1655.TP
1656.B dev
1657dev_t for the block or character device.
1658.TP
1659.B sfdir
1660shortform (in-inode) version 1 directory. This consists of a
1661.B hdr
1662containing the
1663.B parent
1664inode number and a
1665.B count
1666of active entries in the directory, followed by an array
1667.B list
1668of
1669.B hdr.count
1670entries. Each such entry contains
1671.BR inumber ,
1672.BR namelen ,
1673and
1674.B name
1675string.
1676.TP
1677.B sfdir2
1678shortform (in-inode) version 2 directory. This consists of a
1679.B hdr
1680containing a
1681.B count
1682of active entries in the directory, an
1683.B i8count
1684of entries with inumbers that don't fit in a 32-bit value, and the
1685.B parent
1686inode number, followed by an array
1687.B list
1688of
1689.B hdr.count
1690entries. Each such entry contains
1691.BR namelen ,
1692a saved
1693.B offset
1694used when the directory is converted to a larger form, a
1695.B name
1696string, and the
1697.BR inumber .
1698.TP
1699.B symlink
1700symbolic link string value.
1701.RE
1702.IP
1703
1704The following fields are in the
1705.B a
1706attribute fork union if it exists:
1707.RS 1.4i
1708.TP 1.2i
1709.B bmbt
1710bmap Btree root, as above.
1711.TP
1712.B bmx
1713array of extent descriptors.
1714.TP
1715.B sfattr
1716shortform (in-inode) attribute values. This consists of a
1717.B hdr
1718containing a
1719.B totsize
1720(total size in bytes) and a
1721.B count
1722of active entries, followed by an array
1723.B list
1724of
1725.B hdr.count
1726entries. Each such entry contains
1727.BR namelen ,
1728.BR valuelen ,
1729.BR root
1730flag,
1731.BR name ,
1732and
1733.BR value .
1734.PD
1735.RE
1736.TP
1737.B log
1738Log blocks contain the journal entries for XFS.
1739It's not useful to examine these with
1740.BR xfs_db ,
1741use
1742.BR xfs_logprint (8)
1743instead.
1744.TP
9fb2cb27
DW
1745.B refcntbt
1746There is one set of filesystem blocks forming the reference count Btree for
1747each allocation group. The root block of this Btree is designated by the
1748.B refcntroot
1749field in the corresponding AGF block. The blocks are linked to sibling left
1750and right blocks at each level, as well as by pointers from parent to child
1751blocks. Each block has the following fields:
1752.RS 1.4i
1753.PD 0
1754.TP 1.2i
1755.B magic
1756REFC block magic number, 0x52334643 ('R3FC').
1757.TP
1758.B level
1759level number of this block, 0 is a leaf.
1760.TP
1761.B numrecs
1762number of data entries in the block.
1763.TP
1764.B leftsib
1765left (logically lower) sibling block, 0 if none.
1766.TP
1767.B rightsib
1768right (logically higher) sibling block, 0 if none.
1769.TP
1770.B recs
1771[leaf blocks only] array of reference count records. Each record contains
1772.BR startblock ,
1773.BR blockcount ,
1774and
1775.BR refcount .
1776.TP
1777.B keys
1778[non-leaf blocks only] array of key records. These are the first value
1779of each block in the level below this one. Each record contains
1780.BR startblock .
1781.TP
1782.B ptrs
1783[non-leaf blocks only] array of child block pointers. Each pointer is a
1784block number within the allocation group to the next level in the Btree.
1785.PD
1786.RE
1787.TP
a9d7b986
DW
1788.B rmapbt
1789There is one set of filesystem blocks forming the reverse mapping Btree for
1790each allocation group. The root block of this Btree is designated by the
1791.B rmaproot
1792field in the corresponding AGF block. The blocks are linked to sibling left
1793and right blocks at each level, as well as by pointers from parent to child
1794blocks. Each block has the following fields:
1795.RS 1.4i
1796.PD 0
1797.TP 1.2i
1798.B magic
1799RMAP block magic number, 0x524d4233 ('RMB3').
1800.TP
1801.B level
1802level number of this block, 0 is a leaf.
1803.TP
1804.B numrecs
1805number of data entries in the block.
1806.TP
1807.B leftsib
1808left (logically lower) sibling block, 0 if none.
1809.TP
1810.B rightsib
1811right (logically higher) sibling block, 0 if none.
1812.TP
1813.B recs
1814[leaf blocks only] array of reference count records. Each record contains
1815.BR startblock ,
1816.BR blockcount ,
1817.BR owner ,
1818.BR offset ,
1819.BR attr_fork ,
1820.BR bmbt_block ,
1821and
1822.BR unwritten .
1823.TP
1824.B keys
1825[non-leaf blocks only] array of double-key records. The first ("low") key
1826contains the first value of each block in the level below this one. The second
1827("high") key contains the largest key that can be used to identify any record
1828in the subtree. Each record contains
1829.BR startblock ,
1830.BR owner ,
1831.BR offset ,
1832.BR attr_fork ,
1833and
1834.BR bmbt_block .
1835.TP
1836.B ptrs
1837[non-leaf blocks only] array of child block pointers. Each pointer is a
1838block number within the allocation group to the next level in the Btree.
1839.PD
1840.RE
1841.TP
2017d0d0
BN
1842.B rtbitmap
1843If the filesystem has a realtime subvolume, then the
1844.B rbmino
1845field in the superblock refers to a file that contains the realtime bitmap.
2bd0ea18 1846Each bit in the bitmap file controls the allocation of a single realtime extent
2017d0d0
BN
1847(set == free). The bitmap is processed in 32-bit words, the LSB of a word is
1848used for the first extent controlled by that bitmap word. The
1849.B atime
1850field of the realtime bitmap inode contains a counter
2bd0ea18
NS
1851that is used to control where the next new realtime file will start.
1852.TP
2017d0d0
BN
1853.B rtsummary
1854If the filesystem has a realtime subvolume, then the
1855.B rsumino
1856field in the superblock refers to a file that contains the realtime summary
1857data. The summary file contains a two-dimensional array of 16-bit values.
2bd0ea18
NS
1858Each value counts the number of free extent runs
1859(consecutive free realtime extents)
1860of a given range of sizes that starts in a given bitmap block.
1861The size ranges are binary buckets (low size in the bucket is a power of 2).
1862There are as many size ranges as are necessary given the size of the
1863realtime subvolume.
1864The first dimension is the size range,
1865the second dimension is the starting bitmap block number
1866(adjacent entries are for the same size, adjacent bitmap blocks).
1867.TP
2017d0d0 1868.B sb
2bd0ea18
NS
1869There is one sb (superblock) structure per allocation group.
1870It is the first disk block in the allocation group.
1871Only the first one (block 0 of the filesystem) is actually used;
2017d0d0
BN
1872the other blocks are redundant information for
1873.BR xfs_repair (8)
1874to use if the first superblock is damaged. Fields defined:
1875.RS 1.4i
1876.PD 0
1877.TP 1.2i
1878.B magicnum
1879superblock magic number, 0x58465342 ('XFSB').
1880.TP
1881.B blocksize
1882filesystem block size in bytes.
1883.TP
1884.B dblocks
1885number of filesystem blocks present in the data subvolume.
1886.TP
1887.B rblocks
1888number of filesystem blocks present in the realtime subvolume.
1889.TP
1890.B rextents
1891number of realtime extents that
1892.B rblocks
1893contain.
1894.TP
1895.B uuid
1896unique identifier of the filesystem.
1897.TP
1898.B logstart
1899starting filesystem block number of the log (journal).
1900If this value is 0 the log is "external".
1901.TP
1902.B rootino
1903root inode number.
1904.TP
1905.B rbmino
1906realtime bitmap inode number.
1907.TP
1908.B rsumino
1909realtime summary data inode number.
1910.TP
1911.B rextsize
1912realtime extent size in filesystem blocks.
1913.TP
1914.B agblocks
1915size of an allocation group in filesystem blocks.
1916.TP
1917.B agcount
1918number of allocation groups.
1919.TP
1920.B rbmblocks
1921number of realtime bitmap blocks.
1922.TP
1923.B logblocks
1924number of log blocks (filesystem blocks).
1925.TP
1926.B versionnum
1927filesystem version information.
2bd0ea18
NS
1928This value is currently 1, 2, 3, or 4 in the low 4 bits.
1929If the low bits are 4 then the other bits have additional meanings.
19301 is the original value.
19312 means that attributes were used.
19323 means that version 2 inodes (large link counts) were used.
19334 is the bitmask version of the version number.
1934In this case, the other bits are used as flags
1935(0x0010: attributes were used,
19360x0020: version 2 inodes were used,
19370x0040: quotas were used,
19380x0080: inode cluster alignment is in force,
19390x0100: data stripe alignment is in force,
2017d0d0
BN
19400x0200: the
1941.B shared_vn
1942field is used,
2bd0ea18 19430x1000: unwritten extent tracking is on,
2017d0d0
BN
19440x2000: version 2 directories are in use).
1945.TP
1946.B sectsize
1947sector size in bytes, currently always 512.
1948This is the size of the superblock and the other header blocks.
1949.TP
1950.B inodesize
1951inode size in bytes.
1952.TP
1953.B inopblock
1954number of inodes per filesystem block.
1955.TP
1956.B fname
1957obsolete, filesystem name.
1958.TP
1959.B fpack
1960obsolete, filesystem pack name.
1961.TP
1962.B blocklog
1963log2 of
1964.BR blocksize .
1965.TP
1966.B sectlog
1967log2 of
1968.BR sectsize .
1969.TP
1970.B inodelog
1971log2 of
1972.BR inodesize .
1973.TP
1974.B inopblog
1975log2 of
1976.BR inopblock .
1977.TP
1978.B agblklog
1979log2 of
1980.B agblocks
1981(rounded up).
1982.TP
1983.B rextslog
1984log2 of
1985.BR rextents .
1986.TP
1987.B inprogress
1988.BR mkfs.xfs (8)
1989or
1990.BR xfs_copy (8)
1991aborted before completing this filesystem.
1992.TP
1993.B imax_pct
1994maximum percentage of filesystem space used for inode blocks.
1995.TP
1996.B icount
1997number of allocated inodes.
1998.TP
1999.B ifree
2000number of allocated inodes that are not in use.
2001.TP
2002.B fdblocks
2003number of free data blocks.
2004.TP
2005.B frextents
2006number of free realtime extents.
2007.TP
2008.B uquotino
2009user quota inode number.
2010.TP
2011.B pquotino
2012project quota inode number; this is currently unused.
2013.TP
2014.B qflags
2015quota status flags
2bd0ea18
NS
2016(0x01: user quota accounting is on,
20170x02: user quota limits are enforced,
20180x04: quotacheck has been run on user quotas,
20190x08: project quota accounting is on,
20200x10: project quota limits are enforced,
2017d0d0
BN
20210x20: quotacheck has been run on project quotas).
2022.TP
2023.B flags
2024random flags. 0x01: only read-only mounts are allowed.
2025.TP
2026.B shared_vn
2027shared version number (shared readonly filesystems).
2028.TP
2029.B inoalignmt
2030inode chunk alignment in filesystem blocks.
2031.TP
2032.B unit
2033stripe or RAID unit.
2034.TP
2035.B width
2036stripe or RAID width.
2037.TP
2038.B dirblklog
2039log2 of directory block size (filesystem blocks).
2040.PD
2041.RE
2bd0ea18 2042.TP
2017d0d0 2043.B symlink
2bd0ea18 2044Symbolic link blocks are used only when the symbolic link value does
2017d0d0 2045not fit inside the inode. The block content is just the string value.
2bd0ea18 2046Bytes past the logical end of the symbolic link value have arbitrary values.
c6b24b3b 2047.TP
2017d0d0 2048.B text
c6b24b3b 2049User file blocks, and other blocks whose type is unknown,
2017d0d0
BN
2050have this type for display purposes in
2051.BR xfs_db .
d2df702b 2052The block data is displayed in two columns: Hexadecimal format
c6b24b3b 2053and printable ASCII chars.
2bd0ea18 2054.SH DIAGNOSTICS
2017d0d0
BN
2055Many messages can come from the
2056.B check
2057.RB ( blockget )
bfc541e7
ES
2058command.
2059If the filesystem is completely corrupt, a core dump might
2060be produced instead of the message
2061.RS
2062.I device
2063.B is not a valid filesystem
2064.RE
2065.PP
2066If the filesystem is very large (has many files) then
2067.B check
2068might run out of memory. In this case the message
2069.RS
2070.B out of memory
2071.RE
2072is printed.
2073.PP
2074The following is a description of the most likely problems and the associated
2075messages.
2076Most of the diagnostics produced are only meaningful with an understanding
2077of the structure of the filesystem.
2078.TP
2079.BI "agf_freeblks " n ", counted " m " in ag " a
2080The freeblocks count in the allocation group header for allocation group
2081.I a
2082doesn't match the number of blocks counted free.
2083.TP
2084.BI "agf_longest " n ", counted " m " in ag " a
2085The longest free extent in the allocation group header for allocation group
2086.I a
2087doesn't match the longest free extent found in the allocation group.
2088.TP
2089.BI "agi_count " n ", counted " m " in ag " a
2090The allocated inode count in the allocation group header for allocation group
2091.I a
2092doesn't match the number of inodes counted in the allocation group.
2093.TP
2094.BI "agi_freecount " n ", counted " m " in ag " a
2095The free inode count in the allocation group header for allocation group
2096.I a
2097doesn't match the number of inodes counted free in the allocation group.
2098.TP
2099.BI "block " a/b " expected inum 0 got " i
2100The block number is specified as a pair
2101(allocation group number, block in the allocation group).
2102The block is used multiple times (shared), between multiple inodes.
2103This message usually follows a message of the next type.
2104.TP
2105.BI "block " a/b " expected type unknown got " y
2106The block is used multiple times (shared).
2107.TP
2108.BI "block " a/b " type unknown not expected
2bd0ea18 2109.SH SEE ALSO
2017d0d0
BN
2110.BR mkfs.xfs (8),
2111.BR xfs_admin (8),
2017d0d0
BN
2112.BR xfs_copy (8),
2113.BR xfs_logprint (8),
2114.BR xfs_metadump (8),
2115.BR xfs_ncheck (8),
2116.BR xfs_repair (8),
2117.BR mount (8),
2118.BR chmod (2),
2119.BR mknod (2),
2120.BR stat (2),
2121.BR xfs (5).