1xfs_db(8)                   System Manager's Manual                  xfs_db(8)
2
3
4

NAME

6       xfs_db - debug an XFS filesystem
7

SYNOPSIS

9       xfs_db [ -c cmd ] ... [ -i|r|x|F ] [ -f ] [ -l logdev ] [ -p progname ]
10       device
11       xfs_db -V
12

DESCRIPTION

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

OPTIONS

20       -c cmd xfs_db commands may be run interactively (the default) or as ar‐
21              guments on the command line. Multiple -c arguments may be given.
22              The commands are run in the sequence given, then the program ex‐
23              its.
24
25       -f     Specifies that the filesystem image to be processed is stored in
26              a  regular  file at device (see the mkfs.xfs(8) -d file option).
27              This might happen if an image copy of a filesystem has been made
28              into an ordinary file with xfs_copy(8).
29
30       -F     Specifies  that we want to continue even if the superblock magic
31              is not correct.  For use in xfs_metadump.
32
33       -i     Allows execution on a mounted filesystem, provided it is mounted
34              read-only.   Useful for shell scripts which must only operate on
35              filesystems in a guaranteed consistent state  (either  unmounted
36              or mounted read-only). These semantics are slightly different to
37              that of the -r option.
38
39       -l logdev
40              Specifies the device where the filesystems external log resides.
41              Only  for  those  filesystems which use an external log. See the
42              mkfs.xfs(8) -l option, and refer to xfs(5) for  a  detailed  de‐
43              scription of the XFS log.
44
45       -p progname
46              Set the program name to progname for prompts and some error mes‐
47              sages, the default value is xfs_db.
48
49       -r     Open device or filename read-only. This option  is  required  if
50              the  filesystem  is  mounted.  It is only necessary to omit this
51              flag if a command that changes data (write, blocktrash, crc)  is
52              to be used.
53
54       -x     Specifies expert mode.  This enables the (write, blocktrash, crc
55              invalidate/revalidate) commands.
56
57       -V     Prints the version number and exits.
58

CONCEPTS

60       xfs_db commands can be broken up into two classes.  Most  commands  are
61       for  the  navigation  and display of data structures in the filesystem.
62       Other commands are for scanning the filesystem in some way.
63
64       Commands which are used to navigate the filesystem structure take argu‐
65       ments  which  reflect  the names of filesystem structure fields.  There
66       can be multiple field names  separated  by  dots  when  the  underlying
67       structures  are nested, as in C.  The field names can be indexed (as an
68       array index) if the underlying field is an array.   The  array  indices
69       can be specified as a range, two numbers separated by a dash.
70
71       xfs_db  maintains a current address in the filesystem.  The granularity
72       of the address is a filesystem structure.  This  can  be  a  filesystem
73       block, an inode or quota (smaller than a filesystem block), or a direc‐
74       tory block (could be larger than a filesystem block).  There are a  va‐
75       riety of commands to set the current address.  Associated with the cur‐
76       rent address is the current data type, which is the structural type  of
77       this  data.   Commands which follow the structure of the filesystem al‐
78       ways set the type as well  as  the  address.   Commands  which  examine
79       pieces  of an individual file (inode) need the current inode to be set,
80       this is done with the inode command.
81
82       The current address/type information is actually maintained in a  stack
83       that  can  be explicitly manipulated with the push, pop, and stack com‐
84       mands.  This allows for easy examination of a nested filesystem  struc‐
85       ture.   Also,  the  last several locations visited are stored in a ring
86       buffer which can be manipulated with the forward, back, and  ring  com‐
87       mands.
88
89       XFS  filesystems  are divided into a small number of allocation groups.
90       xfs_db maintains a notion of the current allocation group which is  ma‐
91       nipulated by some commands. The initial allocation group is 0.
92

COMMANDS

94       Many commands have extensive online help. Use the help command for more
95       details on any command.
96
97       a      See the addr command.
98
99       ablock filoff
100              Set current address to the offset  filoff  (a  filesystem  block
101              number) in the attribute area of the current inode.
102
103       addr [field-expression]
104              Set  current address to the value of the field-expression.  This
105              is used to "follow" a reference in one structure to  the  object
106              being  referred to. If no argument is given, the current address
107              is printed.
108
109       agf [agno]
110              Set current address to the AGF block for allocation group  agno.
111              If no argument is given, use the current allocation group.
112
113       agfl [agno]
114              Set current address to the AGFL block for allocation group agno.
115              If no argument is given, use the current allocation group.
116
117       agi [agno]
118              Set current address to the AGI block for allocation group  agno.
119              If no argument is given, use the current allocation group.
120
121       agresv [agno]
122              Displays  the length, free block count, per-AG reservation size,
123              and per-AG reservation usage for a given AG.  If no argument  is
124              given, display information for all AGs.
125
126       attr_remove [-r|-u|-s] [-n] name
127              Remove the specified extended attribute from the current file.
128
129                 -r  Sets the attribute in the root namespace.  Only one name‐
130                     space option can be specified.
131
132                 -u  Sets the attribute in the user namespace.  Only one name‐
133                     space option can be specified.
134
135                 -s  Sets  the  attribute  in  the secure namespace.  Only one
136                     namespace option can be specified.
137
138                 -n  Do not enable 'noattr2' mode on V4 filesystems.
139
140       attr_set [-r|-u|-s] [-n] [-R|-C] [-v namelen] name
141              Sets an extended attribute on the current file  with  the  given
142              name.
143
144                 -r  Sets the attribute in the root namespace.  Only one name‐
145                     space option can be specified.
146
147                 -u  Sets the attribute in the user namespace.  Only one name‐
148                     space option can be specified.
149
150                 -s  Sets  the  attribute  in  the secure namespace.  Only one
151                     namespace option can be specified.
152
153                 -n  Do not enable 'noattr2' mode on V4 filesystems.
154
155                 -R  Replace the attribute.  The command will fail if the  at‐
156                     tribute does not already exist.
157
158                 -C  Create  the  attribute.  The command will fail if the at‐
159                     tribute already exists.
160
161                 -v  Set the attribute value to a string of this  length  con‐
162                     taining the letter 'v'.
163
164       b      See the back command.
165
166       back   Move to the previous location in the position ring.
167
168       blockfree
169              Free  block usage information collected by the last execution of
170              the blockget command. This must be done before another  blockget
171              command  can  be given, presumably with different arguments than
172              the previous one.
173
174       blockget [-npvs] [-b bno] ... [-i ino] ...
175              Get block usage and check filesystem consistency.  The  informa‐
176              tion  is  saved  for  use  by  a subsequent blockuse, ncheck, or
177              blocktrash command.
178
179                 -b  is used to specify filesystem block numbers  about  which
180                     verbose information should be printed.
181
182                 -i  is  used to specify inode numbers about which verbose in‐
183                     formation should be printed.
184
185                 -n  is used to save pathnames for  inodes  visited,  this  is
186                     used  to support the xfs_ncheck(8) command. It also means
187                     that pathnames will be printed for inodes that have prob‐
188                     lems.  This option uses a lot of memory so is not enabled
189                     by default.
190
191                 -p  causes error messages to be prefixed with the  filesystem
192                     name being processed. This is useful if several copies of
193                     xfs_db are run in parallel.
194
195                 -s  restricts output to severe errors only. This is useful if
196                     the output is too long otherwise.
197
198                 -v  enables  verbose output. Messages will be printed for ev‐
199                     ery block and inode processed.
200
201       blocktrash [-z] [-o offset] [-n count] [-x  min]  [-y  max]  [-s  seed]
202       [-0|1|2|3] [-t type] ...
203              Trash  randomly  selected  filesystem metadata blocks.  Trashing
204              occurs to randomly selected bits in  the  chosen  blocks.   This
205              command  is  available only in debugging versions of xfs_db.  It
206              is useful for testing xfs_repair(8).
207
208                 -0 | -1 | -2 | -3
209                     These are used to set the operating mode for  blocktrash.
210                     Only  one  can  be  used: -0 changed bits are cleared; -1
211                     changed bits are set; -2 changed bits  are  inverted;  -3
212                     changed bits are randomized.
213
214                 -n  supplies the count of block-trashings to perform (default
215                     1).
216
217                 -o  supplies the bit offset at which to  start  trashing  the
218                     block.   If  the value is preceded by a '+', the trashing
219                     will start at a randomly chosen  offset  that  is  larger
220                     than  the  value  supplied.   The  default is to randomly
221                     choose an offset anywhere in the block.
222
223                 -s  supplies a seed to the random processing.
224
225                 -t  gives a type of blocks to be selected for trashing.  Mul‐
226                     tiple -t options may be given. If no -t options are given
227                     then all metadata types can be trashed.
228
229                 -x  sets the minimum size of bit range to be trashed. The de‐
230                     fault value is 1.
231
232                 -y  sets the maximum size of bit range to be trashed. The de‐
233                     fault value is 1024.
234
235                 -z  trashes the block at the top of the  stack.   It  is  not
236                     necessary to run blockget if this option is supplied.
237
238       blockuse [-n] [-c count]
239              Print  usage  for  current filesystem block(s).  For each block,
240              the type and (if any) inode are printed.
241
242                 -c  specifies a count of blocks to process. The default value
243                     is 1 (the current block only).
244
245                 -n  specifies  that  file  names should be printed. The prior
246                     blockget command must have also specified the -n option.
247
248       bmap [-a] [-d] [block [len]]
249              Show the block map for the current inode.  The map  display  can
250              be  restricted to an area of the file with the block and len ar‐
251              guments. If block is given and len is omitted then 1 is  assumed
252              for len.
253
254              The  -a  and -d options are used to select the attribute or data
255              area of the inode, if neither option is given  then  both  areas
256              are shown.
257
258       btdump [-a] [-i]
259              If  the  cursor points to a btree node, dump the btree from that
260              block downward.  If instead the cursor points to an inode,  dump
261              the  data fork block mapping btree if there is one.  If the cur‐
262              sor points to a directory or extended attribute btree node, dump
263              that.  By default, only records stored in the btree are dumped.
264
265                 -a  If  the  cursor points at an inode, dump the extended at‐
266                     tribute block mapping btree, if present.
267
268                 -i  Dump all keys and pointers in intermediate  btree  nodes,
269                     and all records in leaf btree nodes.
270
271       btheight [-b blksz] [-n recs] [-w max|min|absmax] btree types...
272              For a given number of btree records and a btree type, report the
273              number of records and blocks for each level of  the  btree,  and
274              the  total number of blocks.  The btree type must be given after
275              the options.
276
277              A  raw  btree  geometry  can   be   provided   in   the   format
278              "record_bytes:key_bytes:ptr_bytes:header_type",            where
279              header_type is one of "short", "long", "shortcrc", or "longcrc".
280
281              The supported btree types  are:  bnobt,  cntbt,  inobt,  finobt,
282              bmapbt, refcountbt, and rmapbt.  The magic value all can be used
283              to walk through all btree types.
284
285              Options are as follows:
286
287                 -b  is used to override the btree block size.  The default is
288                     the filesystem block size.
289
290                 -n  is  used to specify the number of records to store.  This
291                     argument is required.
292
293                 -w absmax
294                     shows the maximum possible height  for  the  given  btree
295                     types.
296
297                 -w max
298                     shows  only  the  best  case  scenario, which is when the
299                     btree blocks are maximally loaded.
300
301                 -w min
302                     shows only the worst case scenario,  which  is  when  the
303                     btree blocks are half full.
304
305       check  See the blockget command.
306
307       convert type number [type number] ... type
308              Convert from one address form to another.  The known types, with
309              alternate names, are:
310                 agblock or  agbno  (filesystem  block  within  an  allocation
311                        group)
312                 agino or aginode (inode number within an allocation group)
313                 agnumber or agno (allocation group number)
314                 bboff or daddroff (byte offset in a daddr)
315                 blkoff  or  fsboff or agboff (byte offset in a agblock or fs‐
316                        block)
317                 byte or fsbyte (byte address in filesystem)
318                 daddr or bb (disk address, 512-byte blocks)
319                 fsblock or fsb or fsbno (filesystem block,  see  the  fsblock
320                        command)
321                 ino or inode (inode number)
322                 inoidx or offset (index of inode in filesystem block)
323                 inooff or inodeoff (byte offset in inode)
324
325              Only  conversions  that  "make sense" are allowed.  The compound
326              form (with more than three arguments) is useful for  conversions
327              such as convert agno ag agbno agb fsblock.
328
329       crc [-i|-r|-v]
330              Invalidates,  revalidates, or validates the CRC (checksum) field
331              of the current structure, if it has one.  This command is avail‐
332              able only on CRC-enabled filesystems.  With no argument, valida‐
333              tion is performed.  Each command will display the resulting  CRC
334              value and state.
335
336                 -i  Invalidate  the structure's CRC value (incrementing it by
337                     one), and write it to disk.
338
339                 -r  Recalculate the current structure's  correct  CRC  value,
340                     and write it to disk.
341
342                 -v  Validate  and  display the current value and state of the
343                     structure's CRC.
344
345       daddr [d]
346              Set current address to the daddr (512 byte block)  given  by  d.
347              If  no value for d is given, the current address is printed, ex‐
348              pressed as a daddr.  The type is set to data (uninterpreted).
349
350       dblock filoff
351              Set current address to the offset  filoff  (a  filesystem  block
352              number) in the data area of the current inode.
353
354       debug [flagbits]
355              Set  debug option bits. These are used for debugging xfs_db.  If
356              no value is given for flagbits, print the current  debug  option
357              bits. These are for the use of the implementor.
358
359       dquot [-g|-p|-u] id
360              Set  current address to a group, project or user quota block for
361              the given ID. Defaults to user quota.
362
363       echo [arg] ...
364              Echo the arguments to the output.
365
366       f      See the forward command.
367
368       forward
369              Move forward to the next entry in the position ring.
370
371       frag [-adflqRrv]
372              Get file fragmentation data. This prints information about frag‐
373              mentation of file data in the filesystem (as opposed to fragmen‐
374              tation of freespace, for which see the  freesp  command).  Every
375              file in the filesystem is examined to see how far from ideal its
376              extent mappings are. A summary is printed giving the totals.
377
378                 -v  sets verbosity, every inode has information  printed  for
379                     it.   The  remaining  options select which inodes and ex‐
380                     tents are examined.  If no options are given then all are
381                     assumed set, otherwise just those given are enabled.
382
383                 -a  enables processing of attribute data.
384
385                 -d  enables processing of directory data.
386
387                 -f  enables processing of regular file data.
388
389                 -l  enables processing of symbolic link data.
390
391                 -q  enables processing of quota file data.
392
393                 -R  enables processing of realtime control file data.
394
395                 -r  enables processing of realtime file data.
396
397       freesp [-bcds] [-A alignment] [-a ag] ... [-e i] [-h h1] ... [-m m]
398              Summarize free space for the filesystem. The free blocks are ex‐
399              amined and totalled, and displayed in the form of  a  histogram,
400              with a count of extents in each range of free extent sizes.
401
402                 -A  reports only free extents with starting blocks aligned to
403                     alignment blocks.
404
405                 -a  adds ag to the list of allocation groups to be processed.
406                     If no -a options are given then all allocation groups are
407                     processed.
408
409                 -b  specifies that the histogram  buckets  are  binary-sized,
410                     with the starting sizes being the powers of 2.
411
412                 -c  specifies that freesp will search the by-size (cnt) space
413                     Btree instead of the default by-block (bno) space Btree.
414
415                 -d  specifies that every free extent will be displayed.
416
417                 -e  specifies that the  histogram  buckets  are  equal-sized,
418                     with the size specified as i.
419
420                 -h  specifies  a starting block number for a histogram bucket
421                     as h1.  Multiple -h's are given to specify  the  complete
422                     set of buckets.
423
424                 -m  specifies  that  the histogram starting block numbers are
425                     powers of m.  This is the general case of -b.
426
427                 -s  specifies that a final summary  of  total  free  extents,
428                     free blocks, and the average free extent size is printed.
429
430       fsb    See the fsblock command.
431
432       fsblock [fsb]
433              Set  current  address  to the fsblock value given by fsb.  If no
434              value for fsb is given the current address is printed, expressed
435              as  an  fsb.   The  type  is  set  to  data (uninterpreted). XFS
436              filesystem block numbers are computed ((agno << agshift)  |  ag‐
437              block) where agshift depends on the size of an allocation group.
438              Use the convert command to convert to and from this form.  Block
439              numbers  given  for file blocks (for instance from the bmap com‐
440              mand) are in this form.
441
442       fsmap [ start ] [ end ]
443              Prints the mapping of disk blocks used  by  an  XFS  filesystem.
444              The  map lists each extent used by files, allocation group meta‐
445              data, journalling logs, and static filesystem metadata, as  well
446              as  any  regions  that  are  unused.   All  blocks, offsets, and
447              lengths are specified in units of  512-byte  blocks,  no  matter
448              what the filesystem's block size is.  The optional start and end
449              arguments can be used to constrain the output  to  a  particular
450              range of disk blocks.
451
452       fuzz [-c] [-d] field action
453              Write  garbage  into a specific structure field on disk.  Expert
454              mode must be enabled to use this command.  The operation happens
455              immediately; there is no buffering.
456
457              The fuzz command can take the following actions against a field:
458
459                 zeroes
460                     Clears all bits in the field.
461
462                 ones
463                     Sets all bits in the field.
464
465                 firstbit
466                     Flips  the  first  bit in the field.  For a scalar value,
467                     this is the highest bit.
468
469                 middlebit
470                     Flips the middle bit in the field.
471
472                 lastbit
473                     Flips the last bit in the field.   For  a  scalar  value,
474                     this is the lowest bit.
475
476                 add Adds a small value to a scalar field.
477
478                 sub Subtracts a small value from a scalar field.
479
480                 random
481                     Randomizes the contents of the field.
482
483              The following switches affect the write behavior:
484
485                 -c  Skip  write  verifiers  and CRC recalculation; allows in‐
486                     valid data to be written to disk.
487
488                 -d  Skip write verifiers but perform CRC  recalculation;  al‐
489                     lows invalid data to be written to disk to test detection
490                     of invalid data.
491
492       hash[-d]"strings
493              Prints the hash value of string using the hash function  of  the
494              XFS directory and attribute implementation.
495
496              If the -d option is specified, the directory-specific hash func‐
497              tion is used.  This only makes a difference on filesystems  with
498              ascii case-insensitive lookups enabled.
499
500       hashcoll [-a] [-s seed] [-n nr] [-p path] -i | names...
501              Create  directory  entries or extended attributes names that all
502              have the same hash value.  The metadump name  obfuscation  algo‐
503              rithm  is used here.  Names are written to standard output, with
504              a NULL between each name for use with xargs -0.
505                 -a  Create extended attribute names.
506                 -i  Read the first name to create from standard input.  Up to
507                     255  bytes  are  read.   If this option is not specified,
508                     first names are taken from the command line.
509                 -n nr
510                     Create this many duplicated names.   The  default  is  to
511                     create one name.
512                 -p path
513                     Create  directory  entries or extended attributes in this
514                     file instead of writing the names to standard output.
515                 -s seed
516                     Seed the random number generator with this value.
517
518       help [command]
519              Print help for one or all commands.
520
521       info   Displays selected geometry  information  about  the  filesystem.
522              The  output  will  have  the same format that mkfs.xfs(8) prints
523              when creating a filesystem or xfs_info(8) prints when querying a
524              filesystem.
525
526       inode [inode#]
527              Set  the  current inode number. If no inode# is given, print the
528              current inode number.
529
530       label [label]
531              Set the filesystem label. The filesystem label can  be  used  by
532              mount(8)  instead  of  using a device special file.  The maximum
533              length of an XFS label is 12 characters - use of a longer  label
534              will  result  in  truncation and a warning will be issued. If no
535              label is given, the current filesystem label is printed.
536
537       log [stop | start filename]
538              Start logging output to filename, stop  logging,  or  print  the
539              current logging status.
540
541       logformat [-c cycle] [-s sunit]
542              Reformats  the  log  to  the  specified log cycle and log stripe
543              unit.  This has the effect of clearing  the  log  destructively.
544              If the log cycle is not specified, the log is reformatted to the
545              current cycle.  If the log stripe unit  is  not  specified,  the
546              stripe unit from the filesystem superblock is used.
547
548       logres Print transaction reservation size information for each transac‐
549              tion type.  This makes it easier to find  discrepancies  in  the
550              reservation  calculations between xfsprogs and the kernel, which
551              will help when diagnosing minimum log size calculation errors.
552
553       ls [-i] [paths]...
554              List the contents of a directory.  If a path resolves to  a  di‐
555              rectory, the directory will be listed.  If no paths are supplied
556              and the IO cursor points at a directory inode, the  contents  of
557              that directory will be listed.
558
559              The output format is: directory cookie, inode number, file type,
560              hash, name length, name.
561
562                 -i  Resolve each of the given paths to an  inode  number  and
563                     print that number.  If no paths are given and the IO cur‐
564                     sor points to an inode, print the inode number.
565
566       metadump [-egow] filename
567              Dumps metadata to a file. See xfs_metadump(8) for more  informa‐
568              tion.
569
570       ncheck [-s] [-i ino] ...
571              Print  name-inode pairs. A blockget -n command must be run first
572              to gather the information.
573
574                 -i  specifies an inode number to be printed. If no -i options
575                     are given then all inodes are printed.
576
577                 -s  specifies that only setuid and setgid files are printed.
578
579       p      See the print command.
580
581       path dir_path
582              Walk  the  directory  tree  to an inode using the supplied path.
583              Absolute and relative paths are supported.
584
585       pop    Pop location from the stack.
586
587       print [field-expression] ...
588              Print field values.  If no argument is given, print  all  fields
589              in the current structure.
590
591       push [command]
592              Push location to the stack. If command is supplied, set the cur‐
593              rent location to the results of command after  pushing  the  old
594              location.
595
596       q      See the quit command.
597
598       quit   Exit xfs_db.
599
600       ring [index]
601              Show position ring (if no index argument is given), or move to a
602              specific entry in the position ring given by index.
603
604       sb [agno]
605              Set current address to SB header in allocation group  agno.   If
606              no agno is given, use the current allocation group number.
607
608       source source-file
609              Process  commands  from  source-file.   source  commands  can be
610              nested.
611
612       stack  View the location stack.
613
614       type [type]
615              Set the current data type to type.  If  no  argument  is  given,
616              show  the  current data type.  The possible data types are: agf,
617              agfl, agi, attr, bmapbta,  bmapbtd,  bnobt,  cntbt,  data,  dir,
618              dir2,  dqblk, inobt, inode, log, refcntbt, rmapbt, rtbitmap, rt‐
619              summary, sb, symlink and text.  See the TYPES section below  for
620              more information on these data types.
621
622       timelimit [OPTIONS]
623              Print  the  minimum and maximum supported values for inode time‐
624              stamps, quota expiration timers, and quota  grace  periods  sup‐
625              ported by this filesystem.  Options include:
626
627                 --bigtime
628                     Print  the time limits of an XFS filesystem with the big‐
629                     time feature enabled.
630
631                 --classic
632                     Print the time limits of a classic XFS filesystem.
633
634                 --compact
635                     Print all limits as raw values on a single line.
636
637                 --pretty
638                     Print the timestamps in the  current  locale's  date  and
639                     time format instead of raw seconds since the Unix epoch.
640
641       uuid [uuid | generate | rewrite | restore]
642              Set  the  filesystem  universally unique identifier (UUID).  The
643              filesystem UUID can be used by mount(8) instead of using  a  de‐
644              vice  special file.  The uuid can be set directly to the desired
645              UUID, or it can be automatically generated  using  the  generate
646              option.  These  options will both write the UUID into every copy
647              of the superblock in the filesystem.  On a CRC-enabled  filesys‐
648              tem,  this  will  set  an  incompatible superblock flag, and the
649              filesystem will not be mountable with older kernels.   This  can
650              be  reverted with the restore option, which will copy the origi‐
651              nal UUID back into place and  clear  the  incompatible  flag  as
652              needed.   rewrite  copies  the current UUID from the primary su‐
653              perblock to all secondary copies of the superblock.  If no argu‐
654              ment is given, the current filesystem UUID is printed.
655
656       version [feature | versionnum features2]
657              Enable  selected features for a filesystem (certain features can
658              be enabled on an unmounted  filesystem,  after  mkfs.xfs(8)  has
659              created  the  filesystem).  Support for unwritten extents can be
660              enabled using the extflg option. Support for version 2 log  for‐
661              mat  can  be enabled using the log2 option. Support for extended
662              attributes can be enabled using the attr1 or attr2 option.  Once
663              enabled,  extended  attributes  cannot be disabled, but the user
664              may toggle between attr1 and attr2 at will  (older  kernels  may
665              not support the newer version).
666
667              If  no  argument  is given, the current version and feature bits
668              are printed.  With one argument, this command will write the up‐
669              dated  version  number  into every copy of the superblock in the
670              filesystem.  If two arguments are given, they will  be  used  as
671              numeric  values  for  the  versionnum and features2 bits respec‐
672              tively, and their string equivalent reported (but  no  modifica‐
673              tions are made).
674
675       write [-c|-d] [field value] ...
676              Write a value to disk.  Specific fields can be set in structures
677              (struct mode), or a block can be set to data values (data mode),
678              or a block can be set to string values (string mode, for symlink
679              blocks).  The operation happens immediately: there is no buffer‐
680              ing.
681
682              Struct  mode  is  in effect when the current type is structural,
683              i.e. not data. For struct  mode,  the  syntax  is  "write  field
684              value".
685
686              Data  mode  is  in effect when the current type is data. In this
687              case the contents of the block can be shifted or rotated left or
688              right,  or filled with a sequence, a constant value, or a random
689              value. In this mode write with no arguments gives more  informa‐
690              tion on the allowed commands.
691
692                 -c  Skip  write  verifiers  and CRC recalculation; allows in‐
693                     valid data to be written to disk.
694
695                 -d  Skip write verifiers but perform CRC recalculation.  This
696                     allows  invalid data to be written to disk to test detec‐
697                     tion of invalid data.  (This is  not  possible  for  some
698                     types.)
699

TYPES

701       This  section  gives  the fields in each structure type and their mean‐
702       ings.  Note that some types of block cover multiple actual  structures,
703       for instance directory blocks.
704
705       agf       The AGF block is the header for block allocation information;
706                 it is in the second 512-byte block of each allocation  group.
707                 The following fields are defined:
708                     magicnum    AGF block magic number, 0x58414746 ('XAGF').
709                     versionnum  version number, currently 1.
710                     seqno       sequence number starting from 0.
711                     length      size  in  filesystem blocks of the allocation
712                                 group. All allocation groups except the  last
713                                 one  of  the filesystem have the superblock's
714                                 agblocks value here.
715                     bnoroot     block number of the root of the Btree holding
716                                 free  space  information sorted by block num‐
717                                 ber.
718                     cntroot     block number of the root of the Btree holding
719                                 free space information sorted by block count.
720                     bnolevel    number   of  levels  in  the  by-block-number
721                                 Btree.
722                     cntlevel    number of levels in the by-block-count Btree.
723                     flfirst     index into the AGFL block of the first active
724                                 entry.
725                     fllast      index  into the AGFL block of the last active
726                                 entry.
727                     flcount     count of active entries in the AGFL block.
728                     freeblks    count of blocks represented in the  freespace
729                                 Btrees.
730                     longest     longest   free   space   represented  in  the
731                                 freespace Btrees.
732                     btreeblks   number of blocks held in the AGF Btrees.
733
734       agfl      The AGFL block contains block numbers for use  of  the  block
735                 allocator; it is in the fourth 512-byte block of each alloca‐
736                 tion group.  Each entry in the active list is a block  number
737                 within  the allocation group that can be used for any purpose
738                 if space runs low.  The AGF block fields flfirst, fllast, and
739                 flcount  designate which entries are currently active.  Entry
740                 space is allocated in  a  circular  manner  within  the  AGFL
741                 block.  Fields defined:
742                     bno         array  of all block numbers. Even those which
743                                 are not active are printed.
744
745       agi       The AGI block is the header for inode allocation information;
746                 it  is  in the third 512-byte block of each allocation group.
747                 Fields defined:
748                     magicnum    AGI block magic number, 0x58414749 ('XAGI').
749                     versionnum  version number, currently 1.
750                     seqno       sequence number starting from 0.
751                     length      size in filesystem blocks of  the  allocation
752                                 group.
753                     count       count of inodes allocated.
754                     root        block number of the root of the Btree holding
755                                 inode allocation information.
756                     level       number of  levels  in  the  inode  allocation
757                                 Btree.
758                     freecount   count  of  allocated  inodes  that are not in
759                                 use.
760                     newino      last inode number allocated.
761                     dirino      unused.
762                     unlinked    an array of inode numbers within the  alloca‐
763                                 tion  group. The entries in the AGI block are
764                                 the heads of lists which run through the  in‐
765                                 ode  next_unlinked field. These inodes are to
766                                 be unlinked the next time the  filesystem  is
767                                 mounted.
768
769       attr      An  attribute  fork  is  organized as a Btree with the actual
770                 data embedded in the leaf blocks. The root of  the  Btree  is
771                 found  in block 0 of the fork.  The index (sort order) of the
772                 Btree is the hash value  of  the  attribute  name.   All  the
773                 blocks contain a blkinfo structure at the beginning, see type
774                 dir for a description. Nonleaf blocks are identical in format
775                 to  those  for  version 1 and version 2 directories, see type
776                 dir for a description. Leaf blocks can refer  to  "local"  or
777                 "remote"  attribute  values. Local values are stored directly
778                 in the leaf block.  Leaf blocks contain the following fields:
779                     hdr         header containing a  blkinfo  structure  info
780                                 (magic  number 0xfbee), a count of active en‐
781                                 tries, usedbytes total  bytes  of  names  and
782                                 values,  the firstused byte in the name area,
783                                 holes set if the block needs compaction,  and
784                                 array freemap as for dir leaf blocks.
785                     entries     array  of  structures  containing  a hashval,
786                                 nameidx (index into the block of  the  name),
787                                 and flags incomplete, root, and local.
788                     nvlist      array  of structures describing the attribute
789                                 names and values. Fields always present: val‐
790                                 uelen  (length  of  value in bytes), namelen,
791                                 and name.  Fields present for  local  values:
792                                 value  (value string). Fields present for re‐
793                                 mote values: valueblk (fork block  number  of
794                                 containing the value).
795
796                 Remote  values  are stored in an independent block in the at‐
797                 tribute fork.  Prior to v5, value blocks  had  no  structure,
798                 but in v5 they acquired a header structure with the following
799                 fields:
800                     magic       attr3 remote block magic  number,  0x5841524d
801                                 ('XARM').
802                     offset      Byte  offset  of  this  data block within the
803                                 overall attribute value.
804                     bytes       Number of bytes stored in this block.
805                     crc         Checksum of the attribute block contents.
806                     uuid        Filesystem UUID.
807                     owner       Inode that owns this attribute value.
808                     bno         Block offset of this block within the inode's
809                                 attribute fork.
810                     lsn         Log serial number of the last time this block
811                                 was logged.
812                     data        The attribute value data.
813
814       bmapbt    Files with many extents in their data or attribute fork  will
815                 have  the  extents  described  by the contents of a Btree for
816                 that fork, instead of being stored  directly  in  the  inode.
817                 Each bmap Btree starts with a root block contained within the
818                 inode.  The other levels of the Btree are stored in  filesys‐
819                 tem  blocks.  The blocks are linked to sibling left and right
820                 blocks at each level, as well as by pointers from  parent  to
821                 child blocks.  Each block contains the following fields:
822                     magic       bmap  Btree  block  magic  number, 0x424d4150
823                                 ('BMAP').
824                     level       level of this block above the leaf level.
825                     numrecs     number of records or keys in the block.
826                     leftsib     left (logically lower) sibling  block,  0  if
827                                 none.
828                     rightsib    right  (logically higher) sibling block, 0 if
829                                 none.
830                     recs        [leaf blocks only] array of  extent  records.
831                                 Each  record  contains  startoff, startblock,
832                                 blockcount, and extentflag (1 if  the  extent
833                                 is unwritten).
834                     keys        [non-leaf  blocks only] array of key records.
835                                 These are the first key value of  each  block
836                                 in the level below this one. Each record con‐
837                                 tains startoff.
838                     ptrs        [non-leaf blocks only] array of  child  block
839                                 pointers.  Each pointer is a filesystem block
840                                 number to the next level in the Btree.
841
842       bnobt     There is one set of filesystem blocks forming  the  by-block-
843                 number  allocation  Btree for each allocation group. The root
844                 block of this Btree is designated by the bnoroot field in the
845                 corresponding  AGF  block.   The blocks are linked to sibling
846                 left and right blocks at each level, as well as  by  pointers
847                 from  parent  to  child blocks.  Each block has the following
848                 fields:
849                     magic       BNOBT   block   magic   number,    0x41425442
850                                 ('ABTB').
851                     level       level number of this block, 0 is a leaf.
852                     numrecs     number of data entries in the block.
853                     leftsib     left  (logically  lower)  sibling block, 0 if
854                                 none.
855                     rightsib    right (logically higher) sibling block, 0  if
856                                 none.
857                     recs        [leaf   blocks   only]   array  of  freespace
858                                 records. Each record contains startblock  and
859                                 blockcount.
860                     keys        [non-leaf  blocks only] array of key records.
861                                 These are the first value of  each  block  in
862                                 the  level  below  this one. Each record con‐
863                                 tains startblock and blockcount.
864                     ptrs        [non-leaf blocks only] array of  child  block
865                                 pointers.  Each  pointer  is  a  block number
866                                 within the allocation group to the next level
867                                 in the Btree.
868
869       cntbt     There  is  one set of filesystem blocks forming the by-block-
870                 count allocation Btree for each allocation  group.  The  root
871                 block of this Btree is designated by the cntroot field in the
872                 corresponding AGF block. The blocks  are  linked  to  sibling
873                 left  and  right blocks at each level, as well as by pointers
874                 from parent to child blocks. Each  block  has  the  following
875                 fields:
876                     magic       CNTBT    block   magic   number,   0x41425443
877                                 ('ABTC').
878                     level       level number of this block, 0 is a leaf.
879                     numrecs     number of data entries in the block.
880                     leftsib     left (logically lower) sibling  block,  0  if
881                                 none.
882                     rightsib    right  (logically higher) sibling block, 0 if
883                                 none.
884                     recs        [leaf  blocks  only]   array   of   freespace
885                                 records.  Each record contains startblock and
886                                 blockcount.
887                     keys        [non-leaf blocks only] array of key  records.
888                                 These  are  the  first value of each block in
889                                 the level below this one.  Each  record  con‐
890                                 tains blockcount and startblock.
891                     ptrs        [non-leaf  blocks  only] array of child block
892                                 pointers. Each  pointer  is  a  block  number
893                                 within the allocation group to the next level
894                                 in the Btree.
895
896       data      User file blocks, and other blocks  whose  type  is  unknown,
897                 have  this  type  for  display purposes in xfs_db.  The block
898                 data is displayed in hexadecimal format.
899
900       dir       A version 1 directory is organized as a Btree with the direc‐
901                 tory  data embedded in the leaf blocks. The root of the Btree
902                 is found in block 0 of the file. The index  (sort  order)  of
903                 the Btree is the hash value of the entry name. All the blocks
904                 contain a blkinfo structure at the beginning with the follow‐
905                 ing fields:
906                     forw        next sibling block.
907                     back        previous sibling block.
908                     magic       magic number for this block type.
909                 The non-leaf (node) blocks have the following fields:
910                     hdr         header  containing  a  blkinfo structure info
911                                 (magic number 0xfebe), the  count  of  active
912                                 entries,  and  the  level of this block above
913                                 the leaves.
914                     btree       array of entries containing hashval  and  be‐
915                                 fore fields. The before value is a block num‐
916                                 ber within the directory file  to  the  child
917                                 block,  the hashval is the last hash value in
918                                 that block.
919                 The leaf blocks have the following fields:
920                     hdr         header containing a  blkinfo  structure  info
921                                 (magic  number  0xfeeb),  the count of active
922                                 entries, namebytes (total name string bytes),
923                                 holes  flag  (block  needs  compaction),  and
924                                 freemap (array of base, size entries for free
925                                 regions).
926                     entries     array   of   structures  containing  hashval,
927                                 nameidx (byte index into  the  block  of  the
928                                 name string), and namelen.
929                     namelist    array  of  structures  containing inumber and
930                                 name.
931
932       dir2      A version 2 directory has four kinds of blocks.  Data  blocks
933                 start  at  offset 0 in the file.  There are two kinds of data
934                 blocks: single-block directories have  the  leaf  information
935                 embedded  at the end of the block, data blocks in multi-block
936                 directories do not.  Node and leaf  blocks  start  at  offset
937                 32GiB  (with  either  a  single  leaf  block or the root node
938                 block).  Freespace blocks start at offset  64GiB.   The  node
939                 and  leaf blocks form a Btree, with references to the data in
940                 the data blocks.  The freespace blocks form an index of long‐
941                 est free spaces within the data blocks.
942
943                 A single-block directory block contains the following fields:
944                     bhdr        header  containing  magic  number  0x58443242
945                                 ('XD2B') and an array bestfree of the longest
946                                 3 free spaces in the block (offset, length).
947                     bu          array  of  union  structures. Each element is
948                                 either an entry or a freespace.  For entries,
949                                 there  are  the  following  fields:  inumber,
950                                 namelen, name, and tag.  For freespace, there
951                                 are  the  following fields: freetag (0xffff),
952                                 length, and tag.  The tag value is  the  byte
953                                 offset in the block of the start of the entry
954                                 it is contained in.
955                     bleaf       array of leaf entries containing hashval  and
956                                 address.  The address is a 64-bit word offset
957                                 into the file.
958                     btail       tail structure containing the total count  of
959                                 leaf  entries  and stale count of unused leaf
960                                 entries.
961                 A data block contains the following fields:
962                     dhdr        header  containing  magic  number  0x58443244
963                                 ('XD2D') and an array bestfree of the longest
964                                 3 free spaces in the block (offset, length).
965                     du          array of union structures as for bu.
966                 Leaf blocks have two possible forms. If the Btree consists of
967                 a  single  leaf then the freespace information is in the leaf
968                 block, otherwise it is in separate blocks and the root of the
969                 Btree  is  a  node block. A leaf block contains the following
970                 fields:
971                     lhdr        header containing a  blkinfo  structure  info
972                                 (magic  number  0xd2f1  for  the  single leaf
973                                 case, 0xd2ff for the true  Btree  case),  the
974                                 total  count of leaf entries, and stale count
975                                 of unused leaf entries.
976                     lents       leaf entries, as for bleaf.
977                     lbests      [single leaf only] array of values which rep‐
978                                 resent  the  longest  freespace  in each data
979                                 block in the directory.
980                     ltail       [single leaf only] tail structure  containing
981                                 bestcount count of lbests.
982                 A node block is identical to that for types attr and dir.
983
984                 A freespace block contains the following fields:
985                     fhdr        header  containing  magic  number  0x58443246
986                                 ('XD2F'), firstdb  first  data  block  number
987                                 covered  by this freespace block, nvalid num‐
988                                 ber of valid entries, and nused number of en‐
989                                 tries representing real data blocks.
990                     fbests      array of values as for lbests.
991
992       dqblk     The  quota  information is stored in files referred to by the
993                 superblock uquotino  and  pquotino  fields.  Each  filesystem
994                 block in a quota file contains a constant number of quota en‐
995                 tries. The quota entry size is currently 136 bytes, so with a
996                 4KiB  filesystem  block  size  there are 30 quota entries per
997                 block. The dquot command is used to locate these  entries  in
998                 the  filesystem.  The file entries are indexed by the user or
999                 project identifier to determine the block and  offset.   Each
1000                 quota entry has the following fields:
1001                     magic          magic number, 0x4451 ('DQ').
1002                     version        version number, currently 1.
1003                     flags          flags, values include 0x01 for user quota,
1004                                    0x02 for project quota.
1005                     id             user or project identifier.
1006                     blk_hardlimit  absolute limit on blocks in use.
1007                     blk_softlimit  preferred limit on blocks in use.
1008                     ino_hardlimit  absolute limit on inodes in use.
1009                     ino_softlimit  preferred limit on inodes in use.
1010                     bcount         blocks actually in use.
1011                     icount         inodes actually in use.
1012                     itimer         time when service will be refused if  soft
1013                                    limit is violated for inodes.
1014                     btimer         time  when service will be refused if soft
1015                                    limit is violated for blocks.
1016                     iwarns         number  of  warnings  issued  about  inode
1017                                    limit violations.
1018                     bwarns         number  of  warnings  issued  about  block
1019                                    limit violations.
1020                     rtb_hardlimit  absolute limit on realtime blocks in use.
1021                     rtb_softlimit  preferred limit on realtime blocks in use.
1022                     rtbcount       realtime blocks actually in use.
1023                     rtbtimer       time when service will be refused if  soft
1024                                    limit is violated for realtime blocks.
1025                     rtbwarns       number  of  warnings issued about realtime
1026                                    block limit violations.
1027
1028       inobt     There is one set of filesystem blocks forming the inode allo‐
1029                 cation  Btree  for  each  allocation group. The root block of
1030                 this Btree is designated by the root field in the correspond‐
1031                 ing  AGI  block.   The  blocks are linked to sibling left and
1032                 right blocks at each level, as well as by pointers from  par‐
1033                 ent to child blocks.  Each block has the following fields:
1034                     magic       INOBT    block   magic   number,   0x49414254
1035                                 ('IABT').
1036                     level       level number of this block, 0 is a leaf.
1037                     numrecs     number of data entries in the block.
1038                     leftsib     left (logically lower) sibling  block,  0  if
1039                                 none.
1040                     rightsib    right  (logically higher) sibling block, 0 if
1041                                 none.
1042                     recs        [leaf blocks only] array  of  inode  records.
1043                                 Each  record  contains  startino  allocation-
1044                                 group relative inode number, freecount  count
1045                                 of  free  inodes in this chunk, and free bit‐
1046                                 map, LSB corresponds to inode 0.
1047                     keys        [non-leaf blocks only] array of key  records.
1048                                 These  are  the  first value of each block in
1049                                 the level below this one.  Each  record  con‐
1050                                 tains startino.
1051                     ptrs        [non-leaf  blocks  only] array of child block
1052                                 pointers. Each  pointer  is  a  block  number
1053                                 within the allocation group to the next level
1054                                 in the Btree.
1055
1056       inode     Inodes are allocated in "chunks" of 64 inodes each. Usually a
1057                 chunk is multiple filesystem blocks, although there are cases
1058                 with large filesystem blocks where a chunk is less  than  one
1059                 block.  The inode Btree (see inobt above) refers to the inode
1060                 numbers per allocation group. The inode numbers directly  re‐
1061                 flect  the location of the inode block on disk. Use the inode
1062                 command to point xfs_db to a specific inode. Each inode  con‐
1063                 tains four regions: core, next_unlinked, u, and a.  core con‐
1064                 tains the fixed information.  next_unlinked is separated from
1065                 the core due to journaling considerations, see type agi field
1066                 unlinked.  u is a union structure that is different  in  size
1067                 and  format  depending  on the type and representation of the
1068                 file data ("data fork").  a is an optional union structure to
1069                 describe  attribute  data, that is different in size, format,
1070                 and location depending on the presence and representation  of
1071                 attribute  data,  and  the  size  of  the  u data ("attribute
1072                 fork").  xfs_db automatically selects the proper  union  mem‐
1073                 bers based on information in the inode.
1074
1075                 The following are fields in the inode core:
1076                     magic       inode magic number, 0x494e ('IN').
1077                     mode        mode  and  type  of  file,  as  described  in
1078                                 chmod(2), mknod(2), and stat(2).
1079                     version     inode version, 1 or 2.
1080                     format      format of u union data (0: xfs_dev_t, 1:  lo‐
1081                                 cal  file - in-inode directory or symlink, 2:
1082                                 extent list, 3: Btree root, 4: unique id [un‐
1083                                 used]).
1084                     nlinkv1     number  of  links  to the file in a version 1
1085                                 inode.
1086                     nlinkv2     number of links to the file in  a  version  2
1087                                 inode.
1088                     projid_lo   owner's project id (low word; version 2 inode
1089                                 only).  projid_hi owner's  project  id  (high
1090                                 word; version 2 inode only).
1091                     uid         owner's user id.
1092                     gid         owner's group id.
1093                     atime       time last accessed (seconds and nanoseconds).
1094                     mtime       time last modified.
1095                     ctime       time created or inode last modified.
1096                     size        number of bytes in the file.
1097                     nblocks     total  number of blocks in the file including
1098                                 indirect and attribute.
1099                     extsize     basic/minimum extent size for the file.
1100                     nextents    number of extents in the data fork.
1101                     naextents   number of extents in the attribute fork.
1102                     forkoff     attribute fork offset in the inode, in 64-bit
1103                                 words from the start of u.
1104                     aformat     format of a data (1: local attribute data, 2:
1105                                 extent list, 3: Btree root).
1106                     dmevmask    DMAPI event mask.
1107                     dmstate     DMAPI state information.
1108                     newrtbm     file is the realtime bitmap and is "new" for‐
1109                                 mat.
1110                     prealloc    file has preallocated data space after EOF.
1111                     realtime    file data is in the realtime subvolume.
1112                     gen         inode generation number.
1113                 The following fields are in the u data fork union:
1114                     bmbt        bmap  Btree  root.  This looks like a bmapbtd
1115                                 block with redundant information removed.
1116                     bmx         array of extent descriptors.
1117                     dev         dev_t for the block or character device.
1118                     sfdir       shortform  (in-inode)  version  1  directory.
1119                                 This  consists of a hdr containing the parent
1120                                 inode number and a count of active entries in
1121                                 the  directory,  followed by an array list of
1122                                 hdr.count entries. Each such  entry  contains
1123                                 inumber, namelen, and name string.
1124                     sfdir2      shortform  (in-inode)  version  2  directory.
1125                                 This consists of a hdr containing a count  of
1126                                 active  entries  in the directory, an i8count
1127                                 of entries with inumbers that don't fit in  a
1128                                 32-bit  value,  and  the parent inode number,
1129                                 followed by an array list  of  hdr.count  en‐
1130                                 tries.  Each  such  entry contains namelen, a
1131                                 saved offset used when the directory is  con‐
1132                                 verted  to  a larger form, a name string, and
1133                                 the inumber.
1134                     symlink     symbolic link string value.
1135                 The following fields are in the a attribute fork union if  it
1136                 exists:
1137                     bmbt        bmap Btree root, as above.
1138                     bmx         array of extent descriptors.
1139                     sfattr      shortform  (in-inode)  attribute values. This
1140                                 consists of a hdr containing a totsize (total
1141                                 size in bytes) and a count of active entries,
1142                                 followed by an array list  of  hdr.count  en‐
1143                                 tries. Each such entry contains namelen, val‐
1144                                 uelen, root flag, name, and value.
1145
1146       log       Log blocks contain the journal entries  for  XFS.   It's  not
1147                 useful  to examine these with xfs_db, use xfs_logprint(8) in‐
1148                 stead.
1149
1150       refcntbt  There is one set of filesystem blocks forming  the  reference
1151                 count Btree for each allocation group. The root block of this
1152                 Btree is designated by the refcntroot  field  in  the  corre‐
1153                 sponding  AGF  block.   The blocks are linked to sibling left
1154                 and right blocks at each level, as well as by  pointers  from
1155                 parent to child blocks.  Each block has the following fields:
1156                     magic       REFC block magic number, 0x52334643 ('R3FC').
1157                     level       level number of this block, 0 is a leaf.
1158                     numrecs     number of data entries in the block.
1159                     leftsib     left  (logically  lower)  sibling block, 0 if
1160                                 none.
1161                     rightsib    right (logically higher) sibling block, 0  if
1162                                 none.
1163                     recs        [leaf  blocks  only] array of reference count
1164                                 records.  Each  record  contains  startblock,
1165                                 blockcount, and refcount.
1166                     keys        [non-leaf  blocks only] array of key records.
1167                                 These are the first value of  each  block  in
1168                                 the  level  below  this one. Each record con‐
1169                                 tains startblock.
1170                     ptrs        [non-leaf blocks only] array of  child  block
1171                                 pointers.  Each  pointer  is  a  block number
1172                                 within the allocation group to the next level
1173                                 in the Btree.
1174
1175       rmapbt    There  is  one  set  of filesystem blocks forming the reverse
1176                 mapping Btree for each allocation group. The  root  block  of
1177                 this  Btree is designated by the rmaproot field in the corre‐
1178                 sponding AGF block.  The blocks are linked  to  sibling  left
1179                 and  right  blocks at each level, as well as by pointers from
1180                 parent to child blocks.  Each block has the following fields:
1181                     magic       RMAP block magic number, 0x524d4233 ('RMB3').
1182                     level       level number of this block, 0 is a leaf.
1183                     numrecs     number of data entries in the block.
1184                     leftsib     left (logically lower) sibling  block,  0  if
1185                                 none.
1186                     rightsib    right  (logically higher) sibling block, 0 if
1187                                 none.
1188                     recs        [leaf blocks only] array of  reference  count
1189                                 records.  Each  record  contains  startblock,
1190                                 blockcount,   owner,    offset,    attr_fork,
1191                                 bmbt_block, and unwritten.
1192                     keys        [non-leaf  blocks  only]  array of double-key
1193                                 records. The first ("low") key  contains  the
1194                                 first  value of each block in the level below
1195                                 this one. The second  ("high")  key  contains
1196                                 the  largest key that can be used to identify
1197                                 any record in the subtree. Each  record  con‐
1198                                 tains  startblock,  owner, offset, attr_fork,
1199                                 and bmbt_block.
1200                     ptrs        [non-leaf blocks only] array of  child  block
1201                                 pointers.  Each  pointer  is  a  block number
1202                                 within the allocation group to the next level
1203                                 in the Btree.
1204
1205       rtbitmap  If  the  filesystem has a realtime subvolume, then the rbmino
1206                 field in the superblock refers to a file  that  contains  the
1207                 realtime  bitmap.   Each  bit in the bitmap file controls the
1208                 allocation of a single realtime extent  (set  ==  free).  The
1209                 bitmap  is  processed  in  32-bit words, the LSB of a word is
1210                 used for the first extent controlled by that bitmap word. The
1211                 atime  field  of the realtime bitmap inode contains a counter
1212                 that is used to control where the next new realtime file will
1213                 start.
1214
1215       rtsummary If  the filesystem has a realtime subvolume, then the rsumino
1216                 field in the superblock refers to a file  that  contains  the
1217                 realtime summary data. The summary file contains a two-dimen‐
1218                 sional array of 16-bit values.  Each value counts the  number
1219                 of  free extent runs (consecutive free realtime extents) of a
1220                 given range of sizes that starts in  a  given  bitmap  block.
1221                 The size ranges are binary buckets (low size in the bucket is
1222                 a power of 2).  There are as many size ranges as  are  neces‐
1223                 sary given the size of the realtime subvolume.  The first di‐
1224                 mension is the size range, the second dimension is the start‐
1225                 ing  bitmap  block  number (adjacent entries are for the same
1226                 size, adjacent bitmap blocks).
1227
1228       sb        There is one sb (superblock) structure per allocation  group.
1229                 It is the first disk block in the allocation group.  Only the
1230                 first one (block 0 of the filesystem) is actually  used;  the
1231                 other  blocks  are redundant information for xfs_repair(8) to
1232                 use if the first superblock is damaged. Fields defined:
1233                     magicnum    superblock magic number, 0x58465342 ('XFSB').
1234                     blocksize   filesystem block size in bytes.
1235                     dblocks     number of filesystem blocks  present  in  the
1236                                 data subvolume.
1237                     rblocks     number  of  filesystem  blocks present in the
1238                                 realtime subvolume.
1239                     rextents    number of realtime extents that rblocks  con‐
1240                                 tain.
1241                     uuid        unique identifier of the filesystem.
1242                     logstart    starting  filesystem  block number of the log
1243                                 (journal).  If this value is  0  the  log  is
1244                                 "external".
1245                     rootino     root inode number.
1246                     rbmino      realtime bitmap inode number.
1247                     rsumino     realtime summary data inode number.
1248                     rextsize    realtime extent size in filesystem blocks.
1249                     agblocks    size  of  an  allocation  group in filesystem
1250                                 blocks.
1251                     agcount     number of allocation groups.
1252                     rbmblocks   number of realtime bitmap blocks.
1253                     logblocks   number of log blocks (filesystem blocks).
1254                     versionnum  filesystem version information.   This  value
1255                                 is currently 1, 2, 3, or 4 in the low 4 bits.
1256                                 If the low bits are 4  then  the  other  bits
1257                                 have  additional meanings.  1 is the original
1258                                 value.  2 means that attributes were used.  3
1259                                 means  that  version  2  inodes  (large  link
1260                                 counts) were used.  4 is the bitmask  version
1261                                 of  the  version  number.   In this case, the
1262                                 other bits are used  as  flags  (0x0010:  at‐
1263                                 tributes  were used, 0x0020: version 2 inodes
1264                                 were used, 0x0040: quotas were used,  0x0080:
1265                                 inode  cluster alignment is in force, 0x0100:
1266                                 data stripe alignment is  in  force,  0x0200:
1267                                 the  shared_vn field is used, 0x1000: unwrit‐
1268                                 ten extent tracking is on, 0x2000: version  2
1269                                 directories are in use).
1270                     sectsize    sector  size  in bytes, currently always 512.
1271                                 This is the size of the  superblock  and  the
1272                                 other header blocks.
1273                     inodesize   inode size in bytes.
1274                     inopblock   number of inodes per filesystem block.
1275                     fname       obsolete, filesystem name.
1276                     fpack       obsolete, filesystem pack name.
1277                     blocklog    log2 of blocksize.
1278                     sectlog     log2 of sectsize.
1279                     inodelog    log2 of inodesize.
1280                     inopblog    log2 of inopblock.
1281                     agblklog    log2 of agblocks (rounded up).
1282                     rextslog    log2 of rextents.
1283                     inprogress  mkfs.xfs(8)  or  xfs_copy(8)  aborted  before
1284                                 completing this filesystem.
1285                     imax_pct    maximum percentage of filesystem  space  used
1286                                 for inode blocks.
1287                     icount      number of allocated inodes.
1288                     ifree       number  of  allocated  inodes that are not in
1289                                 use.
1290                     fdblocks    number of free data blocks.
1291                     frextents   number of free realtime extents.
1292                     uquotino    user quota inode number.
1293                     pquotino    project quota inode number; this is currently
1294                                 unused.
1295                     qflags      quota status flags (0x01: user quota account‐
1296                                 ing is on, 0x02: user quota  limits  are  en‐
1297                                 forced, 0x04: quotacheck has been run on user
1298                                 quotas, 0x08: project quota accounting is on,
1299                                 0x10:  project  quota  limits  are  enforced,
1300                                 0x20: quotacheck has been run on project quo‐
1301                                 tas).
1302                     flags       random flags. 0x01: only read-only mounts are
1303                                 allowed.
1304                     shared_vn   shared  version   number   (shared   readonly
1305                                 filesystems).
1306                     inoalignmt  inode chunk alignment in filesystem blocks.
1307                     unit        stripe or RAID unit.
1308                     width       stripe or RAID width.
1309                     dirblklog   log2  of  directory  block  size  (filesystem
1310                                 blocks).
1311
1312       symlink   Symbolic link blocks are used only  when  the  symbolic  link
1313                 value  does  not  fit  inside the inode. The block content is
1314                 just the string value.  Bytes past the  logical  end  of  the
1315                 symbolic link value have arbitrary values.
1316
1317       text      User  file  blocks,  and  other blocks whose type is unknown,
1318                 have this type for display purposes  in  xfs_db.   The  block
1319                 data  is  displayed  in  two  columns: Hexadecimal format and
1320                 printable ASCII chars.
1321

DIAGNOSTICS

1323       Many messages can come from  the  check  (blockget)  command.   If  the
1324       filesystem is completely corrupt, a core dump might be produced instead
1325       of the message
1326              device is not a valid filesystem
1327
1328       If the filesystem is very large (has many files) then check  might  run
1329       out of memory. In this case the message
1330              out of memory
1331       is printed.
1332
1333       The  following is a description of the most likely problems and the as‐
1334       sociated messages.  Most of the diagnostics produced are only  meaning‐
1335       ful with an understanding of the structure of the filesystem.
1336
1337       agf_freeblks n, counted m in ag a
1338              The  freeblocks count in the allocation group header for alloca‐
1339              tion group a doesn't match the number of blocks counted free.
1340
1341       agf_longest n, counted m in ag a
1342              The longest free extent in the allocation group header for allo‐
1343              cation  group  a  doesn't match the longest free extent found in
1344              the allocation group.
1345
1346       agi_count n, counted m in ag a
1347              The allocated inode count in the allocation group header for al‐
1348              location  group  a doesn't match the number of inodes counted in
1349              the allocation group.
1350
1351       agi_freecount n, counted m in ag a
1352              The free inode count in the allocation group header for  alloca‐
1353              tion  group a doesn't match the number of inodes counted free in
1354              the allocation group.
1355
1356       block a/b expected inum 0 got i
1357              The block number is specified as a pair (allocation  group  num‐
1358              ber, block in the allocation group).  The block is used multiple
1359              times (shared), between multiple inodes.  This  message  usually
1360              follows a message of the next type.
1361
1362       block a/b expected type unknown got y
1363              The block is used multiple times (shared).
1364
1365       block a/b type unknown not expected
1366

SEE ALSO

1368       mkfs.xfs(8),  xfs_admin(8),  xfs_copy(8),  xfs_logprint(8),  xfs_metad‐
1369       ump(8), xfs_ncheck(8),  xfs_repair(8),  mount(8),  chmod(2),  mknod(2),
1370       stat(2), xfs(5).
1371
1372
1373
1374                                                                     xfs_db(8)
Impressum