]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - man/man8/xfs_io.8
xfs_io tweaks to allow some operations to work on non-XFS files (blkdev, etc).
[thirdparty/xfsprogs-dev.git] / man / man8 / xfs_io.8
1 .TH xfs_io 8
2 .SH NAME
3 xfs_io \- debug the IO path of an XFS filesystem
4 .SH SYNOPSIS
5 .nf
6 \f3xfs_io\f1 [ \f3\-c\f1 cmd ] ... [ \f3\-p\f1 prog ] [ \f3\-Ffr\f1 ] file
7 .fi
8 .SH DESCRIPTION
9 \f2xfs_io\f1 is a debugging tool like \f2xfs_db\f1(8), but is aimed
10 at examining the regular file IO path rather than the raw XFS volume
11 itself.
12 .PP
13 The options to \f2xfs_io\f1 are:
14 .TP 10
15 \f3\-c\f1 \f2cmd\f1
16 \f2xfs_io\f1 commands may be run interactively (the default)
17 or as arguments on the command line.
18 Multiple \f3\-c\f1 arguments may be given.
19 The commands are run in the sequence given, then the program exits.
20 This is the mechanism used to implement \f2xfs_bmap\f1(8).
21 .TP
22 \f3\-p\f1 \f2prog\f1
23 Set the program name for prompts and some error messages,
24 the default value is \f2xfs_io\f1.
25 .TP
26 \f3\-F\f1
27 Allow \f2file\f1 to be ``foreign'', i.e. not in an XFS filesystem.
28 This mode has a restricted set of commands.
29 .TP
30 \f3\-f\f1
31 Create \f2file\f1 if it does not already exist.
32 .TP
33 \f3\-r\f1
34 Open \f2file\f1 read-only, initially.
35 .SH CONCEPTS
36 \f2xfs_io\f1 always maintains one current open file in the filesystem.
37 This is initially specified on the command line, but alternate files
38 can be specified later (one at a time \- see the ``open'' command).
39 .PP
40 \f2xfs_io\f1 commands can be broken up into two distinct classes.
41 Most commands are for doing IO to the file in some way - reads, writes,
42 or space preallocation.
43 Other commands are for the navigation and display of data structures
44 relating to the open file or the filesystem it resides in.
45 .SH COMMANDS
46 .PP
47 Many commands have extensive online help.
48 Use the \f3help\f1 command for more details on any command.
49 .TP 10
50 \f3allocsp\f1 \f2offset\f1 \f2length\f1
51 Allocates zeroed space for part of a file using the XFS_IOC_ALLOCSP
52 system call described in \f2xfs\f1(5).
53 .TP
54 \f3freesp\f1 \f2offset\f1 \f2length\f1
55 Frees space for part of a file using the XFS_IOC_FREESP
56 system call described in \f2xfs\f1(5).
57 .TP
58 \f3bmap\f1 [ \f2-adlpv\f1 ] [ \f2-n nx\f1 ]
59 Prints the block mapping for the open file.
60 Refer to \f2xfs_bmap\f1(8) for complete documentation.
61 .TP
62 \f3fdatasync\f1
63 Calls \f2fdatasync\f1(2) to flush the open file's in-core data to disk.
64 .TP
65 \f3fsync\f1
66 Calls \f2fsync\f1(2) to flush all in-core file state to disk.
67 .TP
68 \f3o\f1
69 See the \f3open\f1 command.
70 .TP
71 \f3open\f1 [ \f2-Facdrstx\f1 ] [ \f2path\f1 ]
72 Closes the current file, and opens the file specified by \f2path\f1 instead.
73 Without any arguments, displays statistics about the currently open file \-
74 see the \f3stat\f1 command.
75 .br
76 The \f3\-F\f1 option allows non-XFS (foreign) files to be opened and
77 operated on with a restricted command set.
78 .br
79 The \f3\-a\f1 option opens append-only (O_APPEND).
80 .br
81 The \f3\-c\f1 option creates the file if it doesn't already exist (O_CREAT).
82 .br
83 The \f3\-d\f1 option opens for direct IO (O_DIRECT).
84 .br
85 The \f3\-r\f1 option opens read-only (O_RDONLY).
86 .br
87 The \f3\-s\f1 option opens for synchronous IO (O_SYNC).
88 .br
89 The \f3\-t\f1 option truncates on open (O_TRUNC).
90 .br
91 The \f3\-x\f1 option marks the file as a realtime XFS file after
92 opening it, if it is not already marked as such.
93 .TP
94 \f3pread\f1
95 Reads a range of bytes in a specified blocksize from the given offset.
96 .br
97 The \f3\-b\f1 option can be used to set the blocksize into which the
98 \f2read\f1(2) requests will be split.
99 The default blocksize is 4096 bytes.
100 .br
101 The \f3\-v\f1 option will dump the contents of the buffer after reading,
102 by default only the count of bytes actually read is dumped.
103 .TP
104 \f3pwrite\f1
105 Writes a range of bytes in a specified blocksize from the given offset.
106 The bytes written can be either a set pattern or read in from another
107 file before writing.
108 .br
109 The \f3\-i\f1 option allows an input file to be specified as the source
110 of the data to be written.
111 .br
112 The \f3\-d\f1 option will cause direct IO, rather than the usual buffered
113 IO, to be used when reading the input file.
114 .br
115 The \f3\-s\f1 options specifies the number of bytes to skip from the
116 start of the input file before starting to read.
117 .br
118 The \f3\-b\f1 option can be used to set the blocksize into which the
119 \f2read\f1(2) requests will be split.
120 The default blocksize is 4096 bytes.
121 The \f3\-S\f1 option is used to set the (repeated) fill pattern which
122 is used when the data to write is not coming from a file.
123 The default buffer fill pattern value is 0xcdcdcdcd.
124 .TP
125 \f3q\f1
126 See the \f3quit\f1 command.
127 .TP
128 \f3quit\f1
129 Exit \f2xfs_io\f1.
130 .TP
131 \f3r\f1
132 See the \f3pread\f1 command.
133 .TP
134 \f3resblks\f1 [ \f2blocks\f1 ]
135 Get and/or set count of reserved filesystem blocks using the
136 XFS_IOC_GET_RESBLKS or XFS_IOC_SET_RESBLKS system calls, as
137 described in \f2xfs\f1(5).
138 Note \-\- this can be useful for exercising out of space behavior.
139 .TP
140 \f3resvsp\f1 \f2offset\f1 \f2length\f1
141 Allocates reserved, unwritten space for part of a file using the XFS_IOC_RESVSP
142 system call described in \f2xfs\f1(5).
143 .TP
144 \f3unresvsp\f1 \f2offset\f1 \f2length\f1
145 Frees reserved space for part of a file using the XFS_IOC_UNRESVSP
146 system call described in \f2xfs\f1(5).
147 .TP
148 \f3s\f1
149 See the \f3fsync\f1 command.
150 .TP
151 \f3stat\f1 [ \f2-v\f1 ]
152 Selected statistics from \f2stat\f1(2) and the XFS_IOC_GETXATTR
153 system call from \f2xfs\f1(5) on the currently open file.
154 If the \f2-v\f1 option is specified, the atime (last access), mtime
155 (last modify), and ctime (last change) timestamps are also displayed.
156 .TP
157 \f3statfs\f1
158 Selected statistics from \f2statfs\f1(2) and the XFS_IOC_FSGEOMETRY
159 system call from \f2xfs\f1(5) on the filesystem where the currently
160 open file resides.
161 .TP
162 \f3truncate\f1 \f2offset\f1
163 Truncates the current file at the given offset using \f2ftruncate\f1(2).
164 .TP
165 \f3w\f1
166 See the \f3pwrite\f1 command.
167 .SH SEE ALSO
168 fdatasync(2),
169 fstat(2),
170 fstatfs(2),
171 fsync(2),
172 ftruncate(2),
173 mkfs.xfs(8),
174 open(2),
175 pread(2),
176 pwrite(2),
177 xfs_bmap(8),
178 xfs_db(8),
179 xfs(5).