# xfs_io(8) - man - phpMan

[xfs_io(8)](https://www.chedong.com/phpMan.php/man/xfsio/8/markdown)                              System Manager's Manual                             [xfs_io(8)](https://www.chedong.com/phpMan.php/man/xfsio/8/markdown)



## NAME
       xfs_io - debug the I/O path of an XFS filesystem

## SYNOPSIS
       **xfs**___**io** [ **-adfimrRstxT** ] [ **-c** _cmd_ ] ... [ **-C** _cmd_ ] ... [ **-p** _prog_ ] _[_ _file_ _]_
       **xfs**___**io** **-V**

## DESCRIPTION
       **xfs**___**io**  is  a  debugging  tool like **xfs**___**[db**(8)](https://www.chedong.com/phpMan.php/man/db/8/markdown), but is aimed at examining the regular file I/O
       paths rather than the raw XFS volume itself.  These code paths include not only  the  obvious
       read/write/mmap  interfaces  for manipulating files, but also cover all of the XFS extensions
       (such as space preallocation, additional inode flags, etc).

## OPTIONS
       **xfs**___**io** commands may be run interactively (the default) or as arguments on the  command  line.
       Interactive  mode always runs commands on the current open file, whilst commands run from the
       command line may be repeated on all open files rather than just the current  open  file.   In
       general,  open  file iteration will occur for commands that operate on file content or state.
       In contrast, commands that operate on filesystem or system-wide state will only be run on the
       current  file  regardless  of  how  many files are currently open.  Multiple arguments may be
       given on the command line and they are run in the sequence given. The program exits  one  all
       commands have been run.

### -c
                 with historical usage, commands that can not be run on all open files will still be
                 run  but  only execute once on the current open file.  Multiple **-c** arguments may be
                 given and may be interleaved on the command line in any order with **-C** commands.

### -C -C
                 be given and may be interleaved on the command line in any order with **-c** commands.

### -p
                 **xfs**___**io**.

### -f

### -r
                 only.

### -i
                 threaded process. With single threaded process, the file table is  not  shared  and
                 file structs are not reference counted.  Spawning an idle thread can help detecting
                 file struct reference leaks.

### -x
                 also tend to require additional privileges.

### -V

       The other [**open**(2)](https://www.chedong.com/phpMan.php/man/open/2/markdown) options described below are also available from the command line.

## CONCEPTS
       **xfs**___**io**  maintains  a number of open files and memory mappings.  Files can be initially opened
       on the command line (optionally), and additional files can also be opened later.

       **xfs**___**io** commands can be broken up into three groups.  Some commands are aimed at doing regular
       file I/O - read, write, sync, space preallocation, etc.

       The  second set of commands exist for manipulating memory mapped regions of a file - mapping,
       accessing, storing, unmapping, flushing, etc.

       The remaining commands are for the navigation and display of data structures relating to  the
       open files, mappings, and the filesystems where they reside.

       Many  commands  have extensive online help. Use the **help** command for more details on any com‐
       mand.

## FILE I/O COMMANDS
       **file** **[** _N_ **]**
              Display a list of all open files and (optionally) switch to an alternate current  open
              file.

       **open** **[[** **-acdfrstRTPL** **]** _path_ **]**
              Closes the current file, and opens the file specified by _path_ instead. Without any ar‐
              guments, displays statistics about the current file - see the **stat** command.
                 **-a**  opens append-only (O_APPEND).
                 **-d**  opens for direct I/O (O_DIRECT).
                 **-f**  creates the file if it doesn't already exist (O_CREAT).
                 **-r**  opens read-only (O_RDONLY).
                 **-s**  opens for synchronous I/O (O_SYNC).
                 **-t**  truncates on open (O_TRUNC).
                 **-n**  opens in non-blocking mode if possible (O_NONBLOCK).
                 **-T**  create a temporary file not linked into the filesystem  namespace  (O_TMPFILE).
                     The  pathname passed must refer to a directory which is treated as virtual par‐
                     ent for the newly created invisible file.  Can not be used together with the **-r**
                     option.
                 **-R**  marks  the  file  as a realtime XFS file after opening it, if it is not already
                     marked as such.
                 **-P**  opens the path as a referent only (O_PATH).  This is  incompatible  with  other
                     flags specifying other O_xxx flags apart from **-L**.
                 **-L**  doesn't  follow  symlinks  (O_NOFOLLOW).  This is incompatible with other flags
                     specifying other O_xxx flags apart from **-P**.

       **o**      See the **open** command.

       **close**  Closes the current open file, marking the next open file as current (if one exists).

       **c**      See the **close** command.

### chmod -r | -w
              Change the mode of the currently open file. The **-r** option will set  the  file  permis‐
              sions to read-only (0444), whilst the **-w** option will set the file permissions to read-
              write (0644). This allows xfs_io to set up mismatches between the file permissions and
              the  open file descriptor read/write mode to exercise permission checks inside various
              syscalls.

       **pread** **[** **-b** _bsize_ **]** **[** **-qv** **]** **[** **-FBR** **[** **-Z** _seed_ **]** **]** **[** **-V** _vectors_ **]** _offset_ _length_
              Reads a range of bytes in a specified blocksize from the given _offset_.
                 **-b**  can be used to set the blocksize into which the [**read**(2)](https://www.chedong.com/phpMan.php/man/read/2/markdown) requests will be split.
                     The default blocksize is 4096 bytes.
                 **-q**  quiet mode, do not write anything to standard output.
                 **-v**  dump  the  contents  of  the buffer after reading, by default only the count of
                     bytes actually read is dumped.
                 **-F**  read the buffers in a forward sequential direction.
                 **-B**  read the buffers in a reverse sequential direction.
                 **-R**  read the buffers in the give range in a random order.
                 **-Z** **seed**
                     specify the random number seed used for random reads.
                 **-V** **vectors**
                     Use the vectored IO read syscall [**preadv**(2)](https://www.chedong.com/phpMan.php/man/preadv/2/markdown) with a number  of  blocksize  length
                     iovecs. The number of iovecs is set by the _vectors_ parameter.

       **r**      See the **pread** command.

       **pwrite** **[** **-i** _file_ **]** **[** **-qdDwNOW** **]** **[** **-s** _skip_ **]** **[** **-b** _size_ **]** **[** **-S** _seed_ **]** **[** **-FBR** **[** **-Z** _zeed_ **]** **]** **[** **-V**
       _vectors_ **]** _offset_ _length_
              Writes a range of bytes in a specified blocksize from the  given  _offset_.   The  bytes
              written can be either a set pattern or read in from another file before writing.
                 **-i**  allows an input _file_ to be specified as the source of the data to be written.
                 **-q**  quiet mode, do not write anything to standard output.
                 **-d**  causes  direct I/O, rather than the usual buffered I/O, to be used when reading
                     the input file.
                 **-w**  call [**fdatasync**(2)](https://www.chedong.com/phpMan.php/man/fdatasync/2/markdown) once all writes are complete (included in timing results)
                 **-N**  Perform the [**pwritev2**(2)](https://www.chedong.com/phpMan.php/man/pwritev2/2/markdown) call with _RWF_NOWAIT_.
                 **-D**  Perform the [**pwritev2**(2)](https://www.chedong.com/phpMan.php/man/pwritev2/2/markdown) call with _RWF_DSYNC_.
                 **-O**  perform pwrite once and return the (maybe partial) bytes written.
                 **-W**  call [**fsync**(2)](https://www.chedong.com/phpMan.php/man/fsync/2/markdown) once all writes are complete (included in timing results)
                 **-s**  specifies the number of bytes to _skip_ from the start of the input  file  before
                     starting to read.
                 **-b**  used  to  set the blocksize into which the [**write**(2)](https://www.chedong.com/phpMan.php/man/write/2/markdown) requests will be split. The
                     default blocksize is 4096 bytes.
                 **-S**  used to set the (repeated) fill pattern which is used when the data to write is
                     not coming from a file.  The default buffer fill pattern value is 0xcdcdcdcd.
                 **-F**  write the buffers in a forward sequential direction.
                 **-B**  write the buffers in a reverse sequential direction.
                 **-R**  write the buffers in the give range in a random order.
                 **-Z** **seed**
                     specify the random number seed used for random write
                 **-V** **vectors**
                     Use  the vectored IO write syscall [**pwritev**(2)](https://www.chedong.com/phpMan.php/man/pwritev/2/markdown) with a number of blocksize length
                     iovecs. The number of iovecs is set by the _vectors_ parameter.

       **w**      See the **pwrite** command.

       **bmap** **[** **-adelpv** **]** **[** **-n** _nx_ **]**
              Prints the block mapping for the current open file. Refer to  the  **xfs**___**[bmap**(8)](https://www.chedong.com/phpMan.php/man/bmap/8/markdown)  manual
              page for complete documentation.

       **fiemap** **[** **-alv** **]** **[** **-n** _nx_ **]** **[** _offset_ **[** _len_ **]]**
              Prints  the  block  mapping for the current open file using the fiemap ioctl.  Options
              behave as described in the **xfs**___**[bmap**(8)](https://www.chedong.com/phpMan.php/man/bmap/8/markdown) manual page.

              Optionally, this command also supports passing the start offset from  where  to  begin
              the  mapping  and  the length of that region.  The kernel will return any full extents
              which intersect with the requested range, and the **fiemap** command will  print  them  in
              their  entirety.   If  the requested range starts or ends in a hole, **fiemap** will print
              the hole, truncated to the requested range.

       **extsize** **[** **-R** **|** **-D** **]** **[** _value_ **]**
              Display and/or modify the preferred extent size used when  allocating  space  for  the
              currently  open  file. If the **-R** option is specified, a recursive descent is performed
              for all directory entries below the currently open file (**-D** can be  used  to  restrict
              the  output  to directories only).  If the target file is a directory, then the inher‐
              ited extent size is set for that directory (new files created in  that  directory  in‐
              herit  that extent size).  The _value_ should be specified in bytes, or using one of the
              usual units suffixes (k, m, g, b, etc). The extent size is always reported in units of
              bytes.

       **cowextsize** **[** **-R** **|** **-D** **]** **[** _value_ **]**
              Display  and/or  modify  the  preferred copy-on-write extent size used when allocating
              space for the currently open file. If the **-R** option is specified, a recursive  descent
              is  performed  for all directory entries below the currently open file (**-D** can be used
              to restrict the output to directories only).  If the target file is a directory,  then
              the inherited CoW extent size is set for that directory (new files created in that di‐
              rectory inherit that CoW extent size).  The _value_ should be specified in bytes, or us‐
              ing  one  of the usual units suffixes (k, m, g, b, etc). The extent size is always re‐
              ported in units of bytes.

       **allocsp** _size_ **0**
              Sets the size of the file to _size_ and zeroes any additional space allocated using  the
              XFS_IOC_ALLOCSP/XFS_IOC_FREESP  system  call  described  in the [**xfsctl**(3)](https://www.chedong.com/phpMan.php/man/xfsctl/3/markdown) manual page.
              **allocsp** and **freesp** do exactly the same thing.

       **freesp** _size_ **0**
              See the **allocsp** command.

       **fadvise** **[** **-r** **|** **-s** **|** **[[** **-d** **|** **-n** **|** **-w** **]** _offset_ _length_ **]]**
              On platforms which support it, allows hints be given to the system regarding  the  ex‐
              pected I/O patterns on the file.  The range arguments are required by some advise com‐
              mands ([*] below), and the others must have no range arguments.   With  no  arguments,
              the POSIX_FADV_NORMAL advice is implied (default readahead).
                 **-d**  the  data  will  not  be  accessed  again  in the near future (POSIX_FADV_DONT‐
                     NEED[*]).
                 **-n**  data will be accessed once and not be reused (POSIX_FADV_NOREUSE[*]).
                 **-r**  expect access to data in random order (POSIX_FADV_RANDOM), which sets readahead
                     to zero.
                 **-s**  expect  access  to data in sequential order (POSIX_FADV_SEQUENTIAL), which dou‐
                     bles the default readahead on the file.
                 **-w**  advises the specified data will be needed again (POSIX_FADV_WILLNEED[*])  which
                     forces the maximum readahead.

### fdatasync
              Calls [**fdatasync**(2)](https://www.chedong.com/phpMan.php/man/fdatasync/2/markdown) to flush the file's in-core data to disk.

       **fsync**  Calls [**fsync**(2)](https://www.chedong.com/phpMan.php/man/fsync/2/markdown) to flush all in-core file state to disk.

       **s**      See the **fsync** command.

       **sync**___**range** **[** **-a** **|** **-b** **|** **-w** **]** **offset** **length**
              On  platforms which support it, allows control of syncing a range of the file to disk.
              With no options, SYNC_FILE_RANGE_WRITE is implied on the range supplied.
                 **-a**  wait   for   IO   in   the   given    range    to    finish    after    writing
                     (SYNC_FILE_RANGE_WAIT_AFTER).
                 **-b**  wait    for    IO    in    the   given   range   to   finish   before   writing
                     (SYNC_FILE_RANGE_WAIT_BEFORE).
                 **-w**  start writeback of dirty data in the given range (SYNC_FILE_RANGE_WRITE).

       **sync**   Calls [**sync**(2)](https://www.chedong.com/phpMan.php/man/sync/2/markdown) to flush all filesystems' in-core data to disk.

       **syncfs** Calls [**syncfs**(2)](https://www.chedong.com/phpMan.php/man/syncfs/2/markdown) to flush this filesystem's in-core data to disk.

       **resvsp** _offset_ _length_
              Allocates reserved, unwritten space for part of a file using the XFS_IOC_RESVSP system
              call described in the [**xfsctl**(3)](https://www.chedong.com/phpMan.php/man/xfsctl/3/markdown) manual page.

       **unresvsp** _offset_ _length_
              Frees  reserved  space  for  part of a file using the XFS_IOC_UNRESVSP system call de‐
              scribed in the [**xfsctl**(3)](https://www.chedong.com/phpMan.php/man/xfsctl/3/markdown) manual page.

       **falloc** **[** **-k** **]** _offset_ _length_
              Allocates reserved, unwritten space for part of a file using the fallocate routine  as
              described in the [**fallocate**(2)](https://www.chedong.com/phpMan.php/man/fallocate/2/markdown) manual page.
                 **-k**  will set the FALLOC_FL_KEEP_SIZE flag as described in [**fallocate**(2)](https://www.chedong.com/phpMan.php/man/fallocate/2/markdown).

       **fcollapse** _offset_ _length_
              Call  fallocate  with  FALLOC_FL_COLLAPSE_RANGE  flag as described in the [**fallocate**(2)](https://www.chedong.com/phpMan.php/man/fallocate/2/markdown)
              manual page to de-allocates blocks and eliminates the hole created in this process  by
              shifting data blocks into the hole.

       **finsert** _offset_ _length_
              Call  fallocate with FALLOC_FL_INSERT_RANGE flag as described in the [**fallocate**(2)](https://www.chedong.com/phpMan.php/man/fallocate/2/markdown) man‐
              ual page to create the hole by shifting data blocks.

       **fpunch** _offset_ _length_
              Punches (de-allocates)  blocks  in  the  file  by  calling  fallocate  with  the  FAL‐
              LOC_FL_PUNCH_HOLE flag as described in the [**fallocate**(2)](https://www.chedong.com/phpMan.php/man/fallocate/2/markdown) manual page.

       **funshare** _offset_ _length_
              Call fallocate with FALLOC_FL_UNSHARE_RANGE flag as described in the [**fallocate**(2)](https://www.chedong.com/phpMan.php/man/fallocate/2/markdown) man‐
              ual page to unshare all shared blocks within the range.

       **fzero** **[** **-k** **]** _offset_ _length_
              Call fallocate with FALLOC_FL_ZERO_RANGE flag as described in the [**fallocate**(2)](https://www.chedong.com/phpMan.php/man/fallocate/2/markdown)  manual
              page  to  allocate and zero blocks within the range.  With the **-k** option, use the FAL‐
              LOC_FL_KEEP_SIZE flag as well.

       **zero** _offset_ _length_
              Call xfsctl with **XFS**___**IOC**___**ZERO**___**RANGE** as described in the [**xfsctl**(3)](https://www.chedong.com/phpMan.php/man/xfsctl/3/markdown) manual page to allo‐
              cate and zero blocks within the range.

       **truncate** _offset_
              Truncates the current file at the given offset using [**ftruncate**(2)](https://www.chedong.com/phpMan.php/man/ftruncate/2/markdown).

       **sendfile** **[** **-q** **]** **-i** _srcfile_ **|** **-f** _N_ **[** _offset_ _length_ **]**
              On  platforms  which  support  it, allows a direct in-kernel copy between two file de‐
              scriptors. The current open file is the target, the source must be  specified  as  an‐
              other open file (**-f**) or by path (**-i**).
                 **-q** quiet mode, do not write anything to standard output.

       **readdir** **[** **-v** **]** **[** **-o** _offset_ **]** **[** **-l** _length_ **]**
              Read a range of directory entries from a given offset of a directory.
                 **-v**  verbose mode - dump dirent content as defined in [**readdir**(3)](https://www.chedong.com/phpMan.php/man/readdir/3/markdown)
                 **-o**  specify starting _offset_
                 **-l**  specify total _length_ to read (in bytes)

### seek  -a | -d | -h [ -r ] [ -s ] offset
              On  platforms  that  support the [**lseek**(2)](https://www.chedong.com/phpMan.php/man/lseek/2/markdown) **SEEK**___**DATA** and **SEEK**___**HOLE** options, display the
              offsets of the specified segments.
                 **-a**  Display both **data** and **hole** segments starting at the specified **offset.**
                 **-d**  Display the **data** segment starting at the specified **offset.**
                 **-h**  Display the **hole** segment starting at the specified **offset.**
                 **-r**  Recursively display all the specified segments starting at the  specified  **off**‐‐
                     **set.**
                 **-s**  Display  the  starting  [lseek(2)](https://www.chedong.com/phpMan.php/man/lseek/2/markdown) offset. This offset will be a calculated value
                     when both data and holes are displayed together or performing a recusively dis‐
                     play.

       **reflink**  **[** **-C** **]** **[** **-q** **]** **src**___**file** **[src**___**offset** **dst**___**offset** **length]**
              On  filesystems  that  support  the  **FICLONERANGE** or **BTRFS**___**IOC**___**CLONE**___**RANGE** ioctls, map
              _length_ bytes at offset _dst_offset_ in the open file to the same  physical  blocks  that
              are mapped at offset _src_offset_ in the file _src_file_ , replacing any contents that may
              already have been there.  If a program writes into a reflinked block range  of  either
              file,  the  dirty blocks will be cloned, written to, and remapped ("copy on write") in
              the affected file, leaving the other file(s) unchanged.   If  src_offset,  dst_offset,
              and length are omitted, all contents of src_file will be reflinked into the open file.
                 **-C**  Print timing statistics in a condensed format.
                 **-q**  Do not print timing statistics at all.

       **dedupe**  **[** **-C** **]** **[** **-q** **]** **src**___**file** **src**___**offset** **dst**___**offset** **length**
              On  filesystems  that  support the **FIDEDUPERANGE** or **BTRFS**___**IOC**___**FILE**___**EXTENT**___**SAME** ioctls,
              map _length_ bytes at offset _dst_offset_ in the open file to  the  same  physical  blocks
              that  are  mapped at offset _src_offset_ in the file _src_file_ , but only if the contents
              of both ranges are identical.  This is known as block-based deduplication.  If a  pro‐
              gram  writes  into  a  reflinked  block range of either file, the dirty blocks will be
              cloned, written to, and remapped ("copy on write") in the affected file,  leaving  the
              other file(s) unchanged.
                 **-C**  Print timing statistics in a condensed format.
                 **-q**  Do not print timing statistics at all.

       **copy**___**range** **[** **-s** _src_offset_ **]** **[** **-d** _dst_offset_ **]** **[** **-l** _length_ **]** **src**___**file** **|** **-f** _N_
              On  filesystems  that support the **copy**___**file**___**[range**(2)](https://www.chedong.com/phpMan.php/man/range/2/markdown) system call, copies data from the
              source file into the current open file.  The source must be specified either  by  path
              (**src**___**file**)  or  as  another  open file (**-f**).  If _length_ is not specified, this command
              copies data from _src_offset_ to the end of **src**___**file** into the dst_file at _dst_offset_.
                 **-s**  Copy data from _src_file_ beginning from _src_offset_.
                 **-d**  Copy data into the open file beginning at _dst_offset_.
                 **-l**  Copy up to _length_ bytes of data.

       **swapext** _donor_file_
              Swaps extent forks between files. The current open file is the target. The donor  file
              is  specified  by path. Note that file data is not copied (file content moves with the
              fork(s)).

       **set**___**encpolicy** **[** **-c** _mode_ **]** **[** **-n** _mode_ **]** **[** **-f** _flags_ **]** **[** **-v** _version_ **]** **[** _keyspec_ **]**
              On filesystems that support encryption, assign an encryption  policy  to  the  current
              file.   _keyspec_ is a hex string which specifies the encryption key to use.  For v1 en‐
              cryption policies, _keyspec_ must be a 16-character hex string (8 bytes).  For v2  poli‐
              cies,  _keyspec_  must be a 32-character hex string (16 bytes).  If unspecified, an all-
              zeroes value is used.
                 **-c** _mode_
                     contents encryption mode (e.g. AES-256-XTS)
                 **-n** _mode_
                     filenames encryption mode (e.g. AES-256-CTS)
                 **-f** _flags_
                     policy flags (numeric)
                 **-v** _version_
                     policy version.  Defaults to 1 or 2 depending on the length of _keyspec_; or to 1
                     if _keyspec_ is unspecified.

       **get**___**encpolicy** **[** **-1** **]** **[** **-t** **]**
              On  filesystems  that support encryption, display the encryption policy of the current
              file.
                 **-1**  Use only the old ioctl to get the encryption policy.  This only  works  if  the
                     file has a v1 encryption policy.
                 **-t**  Test whether v2 encryption policies are supported.  Prints "supported", "unsup‐
                     ported", or an error message.

       **add**___**enckey** **[** **-d** _descriptor_ **]** **[** **-k** _key_id_ **]**
              On filesystems that support encryption, add an encryption key to the  filesystem  con‐
              taining  the  currently  open  file.   By default, the raw key in binary (typically 64
              bytes long) is read from standard input.
                 **-d** _descriptor_
                     key descriptor, as a 16-character hex string (8 bytes).  If given, the key will
                     be  available for use by v1 encryption policies that use this descriptor.  Oth‐
                     erwise, the key is added as a v2 policy key, and on success the resulting  "key
                     identifier" will be printed.
                 **-k** _key_id_
                     ID of kernel keyring key of type "fscrypt-provisioning".  If given, the raw key
                     will be taken from here rather than from standard input.

       **rm**___**enckey** **[** **-a** **]** _keyspec_
              On filesystems that support encryption, remove an encryption key from  the  filesystem
              containing the currently open file.  _keyspec_ is a hex string specifying the key to re‐
              move, as a 16-character "key descriptor" or a 32-character "key identifier".
                 **-a**  Remove the key for all users who have added it,  not  just  the  current  user.
                     This is a privileged operation.

       **enckey**___**status** _keyspec_
              On  filesystems  that  support  encryption,  display  the status of an encryption key.
              _keyspec_ is a hex string specifying the key for which  to  display  the  status,  as  a
              16-character "key descriptor" or a 32-character "key identifier".

       **lsattr** [ **-R** | **-D** | **-a** | **-v** ]
              List extended inode flags on the currently open file. If the **-R** option is specified, a
              recursive descent is performed for all directory entries below the currently open file
              (**-D**  can  be  used to restrict the output to directories only).  This is a depth first
              descent, it does not follow symlinks and it also does not cross mount points.

              The  current  inode  flag  letters  are  documented  below.   Please  refer   to   the
              **ioctl**___**xfs**___**[fsgetxattr**(2)](https://www.chedong.com/phpMan.php/man/fsgetxattr/2/markdown) documentation for more details about what they mean.

              **r**    realtime file (XFS_XFLAG_REALTIME)

              **p**    prealloc (XFS_XFLAG_PREALLOC)

              **i**    immutable (XFS_XFLAG_IMMUTABLE)

              **a**    append only (XFS_XFLAG_APPEND)

              **s**    synchronous file writes (XFS_XFLAG_SYNC)

              **A**    noatime (XFS_XFLAG_NOATIME)

              **d**    nodump (XFS_XFLAG_NODUMP)

              **t**    inherit realtime flag (XFS_XFLAG_RTINHERIT)"

              **P**    inherit project id (XFS_XFLAG_PROJINHERIT)

              **n**    no symlink creation (XFS_XFLAG_NOSYMLINKS)

              **e**    extent size hint (XFS_XFLAG_EXTSIZE)

              **E**    inherit extent size hint (XFS_XFLAG_EXTSZINHERIT)

              **f**    nodefrag (XFS_XFLAG_NODEFRAG)

              **S**    filestream allocator (XFS_XFLAG_FILESTREAM)

              **x**    direct access persistent memory (XFS_XFLAG_DAX)

              **C**    copy on write extent hint (XFS_XFLAG_COWEXTSIZE)

              **X**    has extended attributes (XFS_XFLAG_HASATTR)

       **chattr** [ **-R** | **-D** ] [ **+**/**-riasAdtPneEfSxC** ]
              Change extended inode flags on the currently open file. The **-R** and **-D** options have the
              same meaning as above.

              See the **lsattr** command above for the list of inode flag letters.

       **flink** _path_
              Link the currently open file descriptor into the filesystem namespace.
       **stat** [ **-v**|**-r** ]
              Selected statistics from [**stat**(2)](https://www.chedong.com/phpMan.php/man/stat/2/markdown) and the XFS_IOC_GETXATTR system call on  the  current
              file. If the **-v** option is specified, the atime (last access), mtime (last modify), and
              ctime (last change) timestamps are also displayed.  The **-r**  option  dumps  raw  fields
              from the stat structure.
       **statx** **[** **-v|-r** **][** **-m** _basic_ **|** **-m** _all_ **|** **-m** _<mask>_ **][** **-FD** **]**
              Selected  statistics  from [**stat**(2)](https://www.chedong.com/phpMan.php/man/stat/2/markdown) and the XFS_IOC_GETXATTR system call on the current
              file.
                 **-v**  Show timestamps.
                 **-r**  Dump raw statx structure values.
                 **-m** **basic**
                     Set the field mask for the statx call to STATX_BASIC_STATS.
                 **-m** **all**
                     Set the the field mask for the statx call to STATX_ALL (default).
                 **-m** **<mask>**
                     Specify a numeric field mask for the statx call.
                 **-F**  Force the attributes to be synced with the server.
                 **-D**  Don't sync attributes with the server.

       **chproj** [ **-R**|**-D** ]
              Modifies the project identifier associated with the current path. The **-R**  option  will
              recursively descend if the current path is a directory. The **-D** option will also recur‐
              sively  descend,  only  setting  modifying  projects  on  subdirectories.    See   the
              **xfs**___**[quota**(8)](https://www.chedong.com/phpMan.php/man/quota/8/markdown) manual page for more information about project identifiers.

       **lsproj** [ **-R**|**-D** ]
              Displays  the  project  identifier associated with the current path. The **-R** and **-D** op‐
              tions behave as described above, in **chproj.**

       **parent** [ **-cpv** ]
              By default this command prints out the parent inode numbers, inode generation  numbers
              and basenames of all the hardlinks which point to the inode of the current file.
                 **-p**  the  output  is similar to the default output except pathnames up to the mount-
                     point are printed out instead of the component name.
                 **-c**  the file's filesystem will check all the parent attributes for consistency.
                 **-v**  verbose output will be printed.
              **[NOTE:** **Not** **currently** **operational** **on** **Linux.]**

       **utimes** _atime_sec_ _atime_nsec_ _mtime_sec_ _mtime_nsec_
              The utimes command changes the atime and mtime of the current  file.   sec  uses  UNIX
              timestamp  notation and is the seconds elapsed since 1970-01-01 00:00:00 UTC.  nsec is
              the nanoseconds since the sec. This value needs to be in the  range  0-999999999  with
              UTIME_NOW and UTIME_OMIT being exceptions.  Each (sec, nsec) pair constitutes a single
              timestamp value.



## MEMORY MAPPED I/O COMMANDS
       **mmap** **[** _N_ **|** **[[** **-rwxS** **]** **[-s** _size_ **]** _offset_ _length_ **]]**
              With no arguments, **mmap** shows the current mappings. Specifying a single numeric  argu‐
              ment  _N_ sets the current mapping. If two arguments are specified (a range specified by
              _offset_ and _length_), a new mapping is created spanning the range,  and  the  protection
              mode  can  be given as a combination of PROT_READ (**-r**), PROT_WRITE (**-w**), and PROT_EXEC
              (**-x**).  The mapping will be created with the MAP_SHARED flag by default,  or  with  the
              Linux specific (MAP_SYNC | MAP_SHARED_VALIDATE) flags if **-S** is given.  **-s** _size_ is used
              to do a mmap(size) && munmap(size) operation at first, try to reserve some  extendible
              free  memory space, if _size_ is bigger than _length_ parameter. But there's not guarantee
              that the memory after _length_ ( up to _size_ ) will stay free.  **e.g.**  "mmap -rw  -s  8192
              1024"  will  mmap  0 ~ 1024 bytes memory, but try to reserve 1024 ~ 8192 free space(no
              guarantee). This free space will helpful  for  "mremap  8192"  without  MREMAP_MAYMOVE
              flag.

       **mm**     See the **mmap** command.

       **mremap** **[** **-f** **<new**___**address>** **]** **[** **-m** **]** _new_length_
              Changes  the  current mapping size to _new_length_.  Whether the mapping may be moved is
              controlled by the flags passed; MREMAP_FIXED (**-f**), or MREMAP_MAYMOVE (**-m**).  _new_length_
              specifies  a page-aligned address to which the mapping must be moved. It can be set to
              139946004389888, 4096k or 1g etc.

       **mrm**    See the **mremap** command.

       **munmap** Unmaps the current memory mapping.

       **mu**     See the **munmap** command.

       **mread** **[** **-f** **|** **-v** **]** **[** **-r** **]** **[** _offset_ _length_ **]**
              Accesses a segment of the current memory mapping, optionally dumping it to  the  stan‐
              dard  output  stream (with **-v** or **-f** option) for inspection. The accesses are performed
              sequentially from the start _offset_ by default, but can also be done from the end back‐
              wards through the mapping if the **-r** option in specified.  The two verbose modes differ
              only in the relative offsets they display, the **-f** option is relative  to  file  start,
              whereas **-v** shows offsets relative to the start of the mapping.

       **mr**     See the **mread** command.

       **mwrite** **[** **-r** **]** **[** **-S** _seed_ **]** **[** _offset_ _length_ **]**
              Stores  a  byte into memory for a range within a mapping.  The default stored value is
              'X', repeated to fill the range specified, but this can be changed using  the  **-S**  op‐
              tion.   The memory stores are performed sequentially from the start offset by default,
              but can also be done from the end backwards through the mapping if the  **-r**  option  in
              specified.

       **mw**     See the **mwrite** command.

       **msync** **[** **-i** **]** **[** **-a** **|** **-s** **]** **[** _offset_ _length_ **]**
              Writes  all modified copies of pages over the specified range (or entire mapping if no
              range specified) to their backing storage  locations.   Also,  optionally  invalidates
              (**-i**)  so  that  subsequent references to the pages will be obtained from their backing
              storage locations (instead of cached copies).  The flush  can  be  done  synchronously
              (**-s)** or asynchronously (**-a**).

       **ms**     See the **msync** command.

       **madvise** **[** **-d** **|** **-r** **|** **-s** **|** **-w** **]** **[** _offset_ _length_ **]**
              Modifies  page  cache behavior when operating on the current mapping.  The range argu‐
              ments are required by some advise  commands  ([*]  below).   With  no  arguments,  the
              POSIX_MADV_NORMAL advice is implied (default readahead).
                 **-d**  the pages will not be needed (POSIX_MADV_DONTNEED[*]).
                 **-r**  expect  random  page  references  (POSIX_MADV_RANDOM),  which sets readahead to
                     zero.
                 **-s**  expect sequential page references (POSIX_MADV_SEQUENTIAL),  which  doubles  the
                     default readahead on the file.
                 **-w**  advises the specified pages will be needed again (POSIX_MADV_WILLNEED[*]) which
                     forces the maximum readahead.

### mincore
              Dumps a list of pages or ranges of pages that are currently in core, for  the  current
              memory mapping.


## FILESYSTEM COMMANDS
       **bulkstat** **[** **-a** _agno_ **]** **[** **-d** **]** **[** **-e** _endino_ **]** **[** **-n** _batchsize_ **]** **[** **-s** _startino_ **]** **[** **-v** _version"_**]**
              Display  raw  stat  information about a bunch of inodes in an XFS filesystem.  Options
              are as follows:
                 **-a** _agno_
                        Display only results from the given allocation group.  If not specified, all
                        results returned will be displayed.
                 **-d**     Print debugging information about call results.
                 **-e** _endino_
                        Stop  displaying  records  when  this  inode number is reached.  Defaults to
                        stopping when the system call stops returning results.
                 **-n** _batchsize_
                        Retrieve at most this many records per call.  Defaults to 4,096.
                 **-s** _startino_
                        Display inode allocation records starting with this inode.  Defaults to  the
                        first inode in the filesystem.  If the given inode is not allocated, results
                        will begin with the next allocated inode in the filesystem.
                 **-v** _version_
                        Use a particular version of the kernel interface.  Currently supported  ver‐
                        sions are 1 and 5.

       **bulkstat**___**single** **[** **-d** **]** **[** **-v** _version_ **]** **[** _inum..._ **|** _special..._ **]**
              Display raw stat information about individual inodes in an XFS filesystem.  The **-d** and
              **-v** options are the same as the **bulkstat** command.  Arguments must be inode  numbers  or
              any of the special values:
                 **root**   Display information about the root directory inode.

       **freeze** Suspend  all write I/O requests to the filesystem of the current file.  Only available
              in expert mode and requires privileges.

       **thaw**   Undo the effects of a filesystem freeze operation.  Only available in expert mode  and
              requires privileges.

       **inject** **[** _tag_ **]**
              Inject  errors into a filesystem to observe filesystem behavior at specific points un‐
              der adverse conditions. Without the _tag_ argument, displays  the  list  of  error  tags
              available.  Only available in expert mode and requires privileges.

       **resblks** **[** _blocks_ **]**
              Get  and/or  set  count of reserved filesystem blocks using the XFS_IOC_GET_RESBLKS or
              XFS_IOC_SET_RESBLKS system calls.  Note -- this can be useful for  exercising  out  of
              space behavior.  Only available in expert mode and requires privileges.

       **shutdown** [ **-f** ]
              Force  the filesystem to shut down, preventing any further IO.  XFS and other filesys‐
              tems  implement  this  functionality,  although  implementation  details  may   differ
              slightly.  Only available in expert mode and requires privileges.

              By  default,  the  filesystem will not attempt to flush completed transactions to disk
              before shutting down the filesystem.  This simulates a disk failure or crash.
                 **-f**  Force the filesystem to flush all completed transactions to disk  before  shut‐
                     ting down, matching XFS behavior when critical corruption is encountered.

### statfs [ -c ] [ -g ] [ -s ]
              Report  selected statistics on the filesystem where the current file resides.  The de‐
              fault behavior is to enable all three reporting options:
                 **-c**     Display **XFS**___**IOC**___**FSCOUNTERS** summary counter data.
                 **-g**     Display **XFS**___**IOC**___**FSGEOMETRY** filesystem geometry data.
                 **-s**     Display [**statfs**(2)](https://www.chedong.com/phpMan.php/man/statfs/2/markdown) data.

       **inode**  **[** **[** **-n** **]** _number_ **]** **[** **-v** **]**
              The inode command queries physical information about an inode. With no  arguments,  it
              will  return  1 or 0, indicating whether or not any inode numbers greater than 32 bits
              are currently in use in the filesystem.  If given an inode _number_ as an argument,  the
              command will return the same inode _number_ if it is in use, or 0 if not. With **-n** _number_
              , the next used inode number after this _number_ will be returned, or zero if  the  sup‐
              plied inode number is the highest one in use. With **-v** the command will also report the
              number of bits (32 or 64) used by the inode _number_ printed in the result; if no  inode
              _number_  was  specified  on  the command line, the maximum possible inode number in the
              system will be printed along with its size.

       **inumbers** **[** **-a** _agno_ **]** **[** **-d** **]** **[** **-e** _endino_ **]** **[** **-n** _batchsize_ **]** **[** **-s** _startino_ **]** **[** **-v** _version_ **]**
              Prints allocation information about groups of inodes in an  XFS  filesystem.   Callers
              can  use  this  information  to figure out which inodes are allocated.  Options are as
              follows:
                 **-a** _agno_
                        Display only results from the given allocation group.  If not specified, all
                        results returned will be displayed.
                 **-d**     Print debugging information about call results.
                 **-e** _endino_
                        Stop  displaying  records  when  this  inode number is reached.  Defaults to
                        stopping when the system call stops returning results.
                 **-n** _batchsize_
                        Retrieve at most this many records per call.  Defaults to 4,096.
                 **-s** _startino_
                        Display inode allocation records starting with this inode.  Defaults to  the
                        first inode in the filesystem.  If the given inode is not allocated, results
                        will begin with the next allocated inode in the filesystem.
                 **-v** _version_
                        Use a particular version of the kernel interface.  Currently supported  ver‐
                        sions are 1 and 5.

       **scrub** _type_ **[** _agnumber_ **|** _ino_ _gen_ **]**
              Scrub  internal  XFS  filesystem metadata.  The **type** parameter specifies which type of
              metadata to scrub.  For AG metadata, one AG number must be specified.  For file  meta‐
              data,  the  scrub  is  applied to the open file unless the inode number and generation
              number are specified.

       **repair** _type_ **[** _agnumber_ **|** _ino_ _gen_ **]**
              Repair internal XFS filesystem metadata.  The **type** parameter specifies which  type  of
              metadata to repair.  For AG metadata, one AG number must be specified.  For file meta‐
              data, the repair is applied to the open file unless the inode  number  and  generation
              number are specified.

       **label** **[** **-c** **|** **-s** _label_ **]**
              On filesystems that support online label manipulation, get, set, or clear the filesys‐
              tem label.  With no options, print the current filesystem label.  The **-c** option clears
              the  filesystem  label by setting it to the null string.  The **-s** _label_ option sets the
              filesystem label to _label_.  If the label is longer than the  filesystem  will  accept,
              **xfs**___**io**  will  print an error message.  XFS filesystem labels can be at most 12 charac‐
              ters long.

       **fsmap** **[** **-d** **|** **-l** **|** **-r** **]** **[** **-m** **|** **-v** **]** **[** **-n** _nx_ **]** **[** _start_ **]** **[** _end_ **]**
              Prints the mapping of disk blocks used by the filesystem  hosting  the  current  file.
              The  map lists each extent used by files, allocation group metadata, journalling logs,
              and static filesystem metadata, as well as any regions that are unused.  Each line  of
              the listings takes the following form:

              _extent_: _major_:_minor_ [_startblock_.._endblock_]: _owner_ _startoffset_.._endoffset_ _length_

              Static  filesystem  metadata, allocation group metadata, btrees, journalling logs, and
              free space are marked by replacing the  _startoffset_.._endoffset_  with  the  appropriate
              marker.   All  blocks, offsets, and lengths are specified in units of 512-byte blocks,
              no matter what the filesystem's block size is.  The optional _start_ and  _end_  arguments
              can  be  used  to constrain the output to a particular range of disk blocks.  If these
              two options are specified, exactly one of **-d**, **-l**, or **-r** must also be set.
                 **-d**     Display only extents from the data device.  This option only applies for XFS
                        filesystems.
                 **-l**     Display only extents from the external log device.  This option only applies
                        to XFS filesystems.
                 **-r**     Display only extents from the realtime device.  This option only applies  to
                        XFS filesystems.
                 **-m**     Display results in a machine readable format (CSV).  This option is not com‐
                        patible with the **-v** flag.  The columns of the output are: extent number, de‐
                        vice major, device minor, physical start, physical end, owner, offset start,
                        offset end, length.  The start, end, and  length  numbers  are  provided  in
                        units of 512b.  The owner field is a special string that takes the form:

                           _inode_%lld_data_
                               for inode data.
                           _inode_%lld_data_bmbt_
                               for inode data extent maps.
                           _inode_%lld_attr_
                               for inode extended attribute data.
                           _inode_%lld_attr_bmbt_
                               for inode extended attribute extent maps.
                           _special_%u:%u_
                               for other filesystem metadata.


                 **-n** _num_extents_
                        If this option is given, **fsmap** obtains the extent list of the file in groups
                        of _num_extents_ extents.  In the absence of **-n**, **fsmap** queries the system  for
                        extents in groups of 131,072 records.

                 **-v**     Shows  verbose information.  When this flag is specified, additional AG spe‐
                        cific information is appended to each line in the following form:

                             _agno_ (_startagblock_.._endagblock_) _nblocks_ _flags_

                        A second **-v** option will print out the _flags_ legend.  This option is not com‐
                        patible with the **-m** flag.



## OTHER COMMANDS
       **help** **[** command **]**
              Display a brief description of one or all commands.

       **print**  Display a list of all open files and memory mapped regions.  The current file and cur‐
              rent mapping are distinguishable from any others.

       **p**      See the **print** command.

       **quit**   Exit **xfs**___**io**.

       **q**      See the **quit** command.

       **log**___**writes** **-d** _device_ **-m** _mark_
              Create a mark named _mark_ in the dm-log-writes log specified by _device._   This  is  in‐
              tended to be equivalent to the shell command:

              **dmsetup** **message** _device_ **0** **mark** _mark_

       **lw**     See the **log**___**writes** command.

### crc32cselftest
              Test  the  internal  crc32c  implementation to make sure that it computes results cor‐
              rectly.

## SEE ALSO
       [**mkfs.xfs**(8)](https://www.chedong.com/phpMan.php/man/mkfs.xfs/8/markdown), [**xfsctl**(3)](https://www.chedong.com/phpMan.php/man/xfsctl/3/markdown), **xfs**___**[bmap**(8)](https://www.chedong.com/phpMan.php/man/bmap/8/markdown), **xfs**___**[db**(8)](https://www.chedong.com/phpMan.php/man/db/8/markdown), [**xfs**(5)](https://www.chedong.com/phpMan.php/man/xfs/5/markdown), [**fdatasync**(2)](https://www.chedong.com/phpMan.php/man/fdatasync/2/markdown),  [**fstat**(2)](https://www.chedong.com/phpMan.php/man/fstat/2/markdown),  [**fstatfs**(2)](https://www.chedong.com/phpMan.php/man/fstatfs/2/markdown),
       [**fsync**(2)](https://www.chedong.com/phpMan.php/man/fsync/2/markdown),  [**ftruncate**(2)](https://www.chedong.com/phpMan.php/man/ftruncate/2/markdown),  [**futimens**(3)](https://www.chedong.com/phpMan.php/man/futimens/3/markdown), [**mmap**(2)](https://www.chedong.com/phpMan.php/man/mmap/2/markdown), [**msync**(2)](https://www.chedong.com/phpMan.php/man/msync/2/markdown), [**open**(2)](https://www.chedong.com/phpMan.php/man/open/2/markdown), [**pread**(2)](https://www.chedong.com/phpMan.php/man/pread/2/markdown), [**pwrite**(2)](https://www.chedong.com/phpMan.php/man/pwrite/2/markdown), **read**‐‐
       [**dir**(3)](https://www.chedong.com/phpMan.php/man/dir/3/markdown), [**dmsetup**(8)](https://www.chedong.com/phpMan.php/man/dmsetup/8/markdown).



                                                                                           [xfs_io(8)](https://www.chedong.com/phpMan.php/man/xfsio/8/markdown)
