xfs_io(8)

NAME
xfs_io - debug the IO path of an XFS filesystem

SYNOPSIS
xfs_io [ -c cmd ] ... [ -p prog ] [ -r ] file

DESCRIPTION
xfs_io is a debugging tool like xfs_db(8), but is aimed at examining the regular file IO path rather than the raw XFS volume itself.

The options to xfs_io are:

-c cmd
    xfs_io commands may be run interactively (the default) or as arguments on the command line. Multiple -c arguments may be given. The commands are run in the sequence given, then the program exits. This is the mechanism used to implement xfs_bmap(8).

-p prog
    Set the program name for prompts and some error messages, the default value is xfs_io.

-r  Open file read-only, initially.

CONCEPTS
xfs_io always maintains one current open file in the filesystem. This is initially specified on the command line, but alternate files can be specified later (one at a time - see the ``open'' command).

xfs_io commands can be broken up into two distinct classes. Most commands are for doing IO to the file in some way - reads, writes, or space preallocation. Other commands are for the navigation and display of data structures relating to the open file or the filesystem it resides in.

COMMANDS

Many commands have extensive online help. Use the help command for more details on any command.

allocsp offset length
    Allocates zeroed space for part of a file using the XFS_IOC_ALLOCSP system call described in xfs(5).

freesp offset length
    Frees space for part of a file using the XFS_IOC_FREESP system call described in xfs(5).

bmap [ -adlpv ] [ -n nx ]
    Prints the block mapping for the open file. Refer to xfs_bmap(8) for complete documentation.

fdatasync
    Calls fdatasync(2) to flush the open file's in-core data to disk.

fsync
    Calls fsync(2) to flush all in-core file state to disk.

o   See the open command.

open [ -acdrstx ] [ path ]
    Closes the current file, and opens the file specified by path instead. Without any arguments, displays statistics about the currently open file - see the stat command.
    The -a option opens append-only (O_APPEND).
    The -c option creates the file if it doesn't already exist (O_CREAT).
    The -d option opens for direct IO (O_DIRECT).
    The -r option opens read-only (O_RDONLY).
    The -s option opens for synchronous IO (O_SYNC).
    The -t option truncates on open (O_TRUNC).
    The -x option marks the file as a realtime XFS file after opening it, if it is not already marked as such.

pread
    Reads a range of bytes in a specified blocksize from the given offset.
    The -b option can be used to set the blocksize into which the read(2) requests will be split. The default blocksize is 4096 bytes.
    The -v option will dump the contents of the buffer after reading, by default only the count of bytes actually read is dumped.

pwrite
    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.
    The -i option allows an input file to be specified as the source of the data to be written.
    The -d option will cause direct IO, rather than the usual buffered IO, to be used when reading the input file.
    The -s options specifies the number of bytes to skip from the start of the input file before starting to read.
    The -b option can be used to set the blocksize into which the read(2) requests will be split. The default blocksize is 4096 bytes. The -S option is 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.

q   See the quit command.

quit
    Exit xfs_io.

r   See the pread command.

resblks [ blocks ]
    Get and/or set count of reserved filesystem blocks using the XFS_IOC_GET_RESBLKS or XFS_IOC_SET_RESBLKS system calls, as described in xfs(5). Note -- this can be useful for exercising out of space behavior.

resvsp offset length
    Allocates reserved, unwritten space for part of a file using the XFS_IOC_RESVSP system call described in xfs(5).

unresvsp offset length
    Frees reserved space for part of a file using the XFS_IOC_UNRESVSP system call described in xfs(5).

s   See the fsync command.

stat [ -v ]
    Selected statistics from stat(2) and the XFS_IOC_GETXATTR system call from xfs(5) on the currently open file. If the -v option is specified, the atime (last access), mtime (last modify), and ctime (last change) timestamps are also displayed.

statfs
    Selected statistics from statfs(2) and the XFS_IOC_FSGEOMETRY system call from xfs(5) on the filesystem where the currently open file resides.

truncate offset
    Truncates the current file at the given offset using ftruncate(2).

w   See the pwrite command.

SEE ALSO
fdatasync(2), fstat(2), fstatfs(2), fsync(2), ftruncate(2), mkfs.xfs(8), open(2), pread(2), pwrite(2), xfs_bmap(8), xfs_db(8), xfs(5).