]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - man/man8/xfs_io.8
Minor xfsprogs updates - man pages, docs, version number bump.
[thirdparty/xfsprogs-dev.git] / man / man8 / xfs_io.8
CommitLineData
e246ba5f
NS
1.TH xfs_io 8
2.SH NAME
48c46ee3 3xfs_io \- debug the I/O path of an XFS filesystem
e246ba5f
NS
4.SH SYNOPSIS
5.nf
48c46ee3 6\f3xfs_io\f1 [ \f3\-c\f1 cmd ] ... [ \f3\-p\f1 prog ] [ \f3\-adFfmrRstx\f1 ] file
e246ba5f
NS
7.fi
8.SH DESCRIPTION
2a1888c5 9\f2xfs_io\f1 is a debugging tool like \f2xfs_db\f1, but is aimed
7289a92c 10at examining the regular file I/O paths rather than the raw XFS volume
e246ba5f 11itself.
7289a92c
NS
12These code paths include not only the obvious read/write/mmap interfaces
13for manipulating files, but also cover all of the XFS extensions (such
14as space preallocation, additional inode flags, etc).
e246ba5f
NS
15.PP
16The options to \f2xfs_io\f1 are:
17.TP 10
18\f3\-c\f1 \f2cmd\f1
19\f2xfs_io\f1 commands may be run interactively (the default)
20or as arguments on the command line.
21Multiple \f3\-c\f1 arguments may be given.
22The commands are run in the sequence given, then the program exits.
e246ba5f
NS
23.TP
24\f3\-p\f1 \f2prog\f1
25Set the program name for prompts and some error messages,
26the default value is \f2xfs_io\f1.
27.TP
f72d20ad 28\f3\-F\f1
c0211f67 29Allow \f2file\f1 to reside in non-XFS (foreign) filesystems.
f72d20ad
NS
30This mode has a restricted set of commands.
31.TP
32\f3\-f\f1
33Create \f2file\f1 if it does not already exist.
34.TP
e246ba5f
NS
35\f3\-r\f1
36Open \f2file\f1 read-only, initially.
48c46ee3
NS
37.TP
38\f3\-x\f1
39Expert mode.
40Dangerous commands are only available in this mode.
41These commands also tend to require additional privileges.
42.PP
43The other \f2open\f1(2) options described below are also available
44from the command line.
e246ba5f 45.SH CONCEPTS
48c46ee3
NS
46\f2xfs_io\f1 maintains a number of open files and memory mappings.
47Files can be initially opened on the command line (optionally),
48and additional files can also be opened later.
49.PP
50\f2xfs_io\f1 commands can be broken up into three groups.
51Some commands are aimed at doing regular file I/O - read, write,
52sync, space preallocation, etc.
53.PP
54The second set of commands exist for manipulating memory mapped regions
55of a file - mapping, accessing, storing, unmapping, flushing, etc.
e246ba5f 56.PP
48c46ee3
NS
57The remaining commands are for the navigation and display of data
58structures relating to the open files, mappings, and the filesystems
59where they reside.
e246ba5f
NS
60.PP
61Many commands have extensive online help.
62Use the \f3help\f1 command for more details on any command.
48c46ee3 63.SH FILE I/O COMMANDS
c0211f67
NS
64.TP
65\f3file\f1 [ \f2N\f1 ]
66Display a list of all open files and (optionally) switch to an alternate
67current open file.
e246ba5f 68.TP 10
48c46ee3 69\f3open\f1 [ \f2\-FacdfrstR\f1 ] [ \f2path\f1 ]
e246ba5f 70Closes the current file, and opens the file specified by \f2path\f1 instead.
48c46ee3 71Without any arguments, displays statistics about the current file \-
e246ba5f
NS
72see the \f3stat\f1 command.
73.br
f72d20ad
NS
74The \f3\-F\f1 option allows non-XFS (foreign) files to be opened and
75operated on with a restricted command set.
76.br
e246ba5f
NS
77The \f3\-a\f1 option opens append-only (O_APPEND).
78.br
48c46ee3 79The \f3\-d\f1 option opens for direct I/O (O_DIRECT).
e246ba5f 80.br
48c46ee3 81The \f3\-f\f1 option creates the file if it doesn't already exist (O_CREAT).
e246ba5f
NS
82.br
83The \f3\-r\f1 option opens read-only (O_RDONLY).
84.br
48c46ee3 85The \f3\-s\f1 option opens for synchronous I/O (O_SYNC).
e246ba5f
NS
86.br
87The \f3\-t\f1 option truncates on open (O_TRUNC).
88.br
48c46ee3 89The \f3\-R\f1 option marks the file as a realtime XFS file after
e246ba5f
NS
90opening it, if it is not already marked as such.
91.TP
48c46ee3
NS
92\f3o\f1
93See the \f3open\f1 command.
94.TP
95\f3close\f1
96Closes the current open file, marking the next open file as current
97(if one exists).
98.TP
99\f3c\f1
100See the \f3close\f1 command.
101.TP
102\f3pread\f1 [ \f2\-b bsize\f1 ] [ \f2\-v\f1 ]
e246ba5f
NS
103Reads a range of bytes in a specified blocksize from the given offset.
104.br
105The \f3\-b\f1 option can be used to set the blocksize into which the
106\f2read\f1(2) requests will be split.
107The default blocksize is 4096 bytes.
108.br
109The \f3\-v\f1 option will dump the contents of the buffer after reading,
110by default only the count of bytes actually read is dumped.
111.TP
48c46ee3
NS
112\f3r\f1
113See the \f3pread\f1 command.
114.TP
115\f3pwrite\f1 [ \f2\-i file\f1 ] [ \f2\-d\f1 ] [ \f2\-s skip\f1 ] [ \f2\-b size\f1 ] [ \f2\-S seed\f1 ]
e246ba5f
NS
116Writes a range of bytes in a specified blocksize from the given offset.
117The bytes written can be either a set pattern or read in from another
118file before writing.
119.br
120The \f3\-i\f1 option allows an input file to be specified as the source
121of the data to be written.
122.br
48c46ee3
NS
123The \f3\-d\f1 option will cause direct I/O, rather than the usual buffered
124I/O, to be used when reading the input file.
e246ba5f
NS
125.br
126The \f3\-s\f1 options specifies the number of bytes to skip from the
127start of the input file before starting to read.
128.br
129The \f3\-b\f1 option can be used to set the blocksize into which the
48c46ee3 130\f2write\f1(2) requests will be split.
e246ba5f
NS
131The default blocksize is 4096 bytes.
132The \f3\-S\f1 option is used to set the (repeated) fill pattern which
133is used when the data to write is not coming from a file.
134The default buffer fill pattern value is 0xcdcdcdcd.
135.TP
48c46ee3
NS
136\f3w\f1
137See the \f3pwrite\f1 command.
e246ba5f 138.TP
48c46ee3
NS
139\f3bmap\f1 [ \f2\-adlpv\f1 ] [ \f2\-n nx\f1 ]
140Prints the block mapping for the current open file.
2a1888c5 141Refer to the \f2xfs_bmap\f1 manual page for complete documentation.
e246ba5f 142.TP
54d46c1c
NS
143\f3extsize\f1 [ \f2\-R\f1 | \f2\-D\f1 ] [ \f2value\f1 ]
144Display and/or modify the preferred extent size used when allocating
145space for the currently open file.
146If the \f2-R\f1 option is specified, a recursive descent is performed
147for all directory entries below the currently open file (\f2-D\f1 can
148be used to restrict the output to directories only).
149If the target file is a directory, then the inherited extent size
150is set for that directory (new files created in that directory
151inherit that extent size).
152The \f2value\f1 should be specified in bytes, or using one of the
153usual units suffixes (k, m, g, b, etc).
154The extent size is always reported in units of bytes.
155.TP
48c46ee3
NS
156\f3allocsp\f1 \f2offset\f1 \f2length\f1
157Allocates zeroed space for part of a file using the XFS_IOC_ALLOCSP
2a1888c5 158system call described in the \f2xfs\f1 manual page.
e246ba5f 159.TP
48c46ee3
NS
160\f3freesp\f1 \f2offset\f1 \f2length\f1
161Frees space for part of a file using the XFS_IOC_FREESP
2a1888c5 162system call described in the \f2xfs\f1 manual page.
48c46ee3
NS
163.TP
164\f3fadvise\f1 [ \f2\-dnrsw\f1 ]
165On platforms which support it, allows hints be given to the system
166regarding the expected I/O patterns on the file.
167The hints are similar to those of the \f3madvise\f1 command,
168discussed later.
169.TP
170\f3fdatasync\f1
171Calls \f2fdatasync\f1(2) to flush the file's in-core data to disk.
172.TP
173\f3fsync\f1
174Calls \f2fsync\f1(2) to flush all in-core file state to disk.
175.TP
176\f3s\f1
177See the \f3fsync\f1 command.
e246ba5f
NS
178.TP
179\f3resvsp\f1 \f2offset\f1 \f2length\f1
180Allocates reserved, unwritten space for part of a file using the XFS_IOC_RESVSP
2a1888c5 181system call described in the \f2xfs\f1 manual page.
e246ba5f
NS
182.TP
183\f3unresvsp\f1 \f2offset\f1 \f2length\f1
184Frees reserved space for part of a file using the XFS_IOC_UNRESVSP
2a1888c5 185system call described in the \f2xfs\f1 manual page.
e246ba5f 186.TP
48c46ee3
NS
187\f3truncate\f1 \f2offset\f1
188Truncates the current file at the given offset using \f2ftruncate\f1(2).
c0211f67
NS
189.TP
190\f3sendfile\f1 \f2\-i infile\f1 | \f2\-f N\f1 [ \f2offset\f1 \f2length\f1 ]
191On platforms which support it, allows a direct in-kernel copy between
192two file descriptors.
193The current open file is the target, the source must be specified as
194another open file (\f2-f\f1) or by path (\f2-i\f2).
48c46ee3
NS
195
196.SH MEMORY MAPPED I/O COMMANDS
197.TP
c0211f67 198\f3mmap\f1 [ \f2-rwx\f1 ] [[ N ] | [ \f2offset\f1 \f2length\f1 ]]
48c46ee3
NS
199With no arguments, \f3mmap\f1 shows the current mappings.
200Specifying a single numeric argument sets the current mapping.
201If two arguments are specified (a range), a new mapping is created
202spanning the range, and the protection mode can be given as a combination of
203PROT_READ (\f2-r\f1), PROT_WRITE (\f2-w\f1), and PROT_EXEC (\f2-x\f1).
204.TP
205\f3mm\f1
206See the \f3mmap\f1 command.
207.TP
208\f3munmap\f1
209Unmaps the current memory mapping.
210.TP
211\f3mu\f1
212See the \f3munmap\f1 command.
213.TP
214\f3mread\f1 [ \-\f2frv\f1 ]
215Accesses a segment of the current memory mapping, optionally dumping it to
216the standard output stream (with \f2-v\f1 or \f2-f\f1 option) for inspection.
217The accesses are performed sequentially from the start offset by default,
218but can also be done from the end backwards through the mapping if
219the \f2-r\f1 option in specified.
220The two verbose modes differ only in the relative offsets they display,
221the \f2-f\f1 option is relative to file start, whereas \f2-v\f1 shows
222offsets relative to the start of the mapping.
223.TP
224\f3mr\f1
225See the \f3mread\f1 command.
226.TP
227\f3mwrite\f1 [ \f2-r\f1 ] [ \f2-S seed\f1 ]
228Stores a byte into memory for a range within a mapping.
229The default stored value is 'X', repeated to fill the range specified,
230but this can be changed using the \f2-S\f1 option.
231The memory stores are performed sequentially from the start offset by default,
232but can also be done from the end backwards through the mapping if the \-\f2r\f1
233option in specified.
234.TP
235\f3mw\f1
236See the \f3mwrite\f1 command.
237.TP
238\f3msync\f1
239Writes all modified copies of pages over the specified range (or entire
240mapping if no range specified) to their backing storage locations.
241Also, optionally invalidates (\f2-i\f1) so that subsequent references to
242the pages will be obtained from their backing storage locations (instead
243of cached copies).
244The flush can be done synchronously (\f2-s\f1) or asynchronously (\f2-a\f1).
245.TP
246\f3ms\f1
247See the \f3msync\f1 command.
248.TP
249\f3madvise\f1 [ \-\f2drwsw\f1 ] [ \f2offset\f1 \f2length\f1 ]
250Modifies page cache behavior when operating on the current mapping.
251The range arguments are required by some advise commands ([*] below).
252With no arguments, the POSIX_MADV_NORMAL advice is implied (default readahead).
253The \f2-d\f1 option says the pages will not be needed (POSIX_MADV_DONTNEED[*]).
254The \f2-r\f1 option says to expect random page references (POSIX_MADV_RANDOM),
255which sets readahead to zero.
256The \f2-s\f1 option says to expect sequential page references
257(POSIX_MADV_SEQUENTIAL), which doubles the default readahead on the file.
258The \f2-w\f1 option advises the specified pages will be needed
259again (POSIX_MADV_WILLNEED[*]) which forces the maximum readahead.
260.TP
261\f3mincore\f1
262Dumps a list of pages or ranges of pages that are currently in core,
263for the current memory mapping.
264
265.SH OTHER COMMANDS
e246ba5f 266.TP
48c46ee3
NS
267\f3print\f1
268Display a list of all open files and memory mapped regions.
269The current file and current mapping are distinguishable from
270any others.
271.TP
272\f3p\f1
273See the \f3print\f1 command.
274.TP
275\f3quit\f1
276Exit \f2xfs_io\f1.
277.TP
278\f3q\f1
279See the \f3quit\f1 command.
280.TP
3392325d 281\f3lsattr\f1 [ \f2\-R\f1 | \f2\-D\f1 | \f2\-a\f1 | \f2\-v\f1 ]
48c46ee3 282List extended inode flags on the currently open file.
3392325d
NS
283If the \f2-R\f1 option is specified, a recursive descent is performed
284for all directory entries below the currently open file (\f2-D\f1 can
285be used to restrict the output to directories only).
286This is a depth first descent, it does not follow symlinks and
287it also does not cross mount points.
48c46ee3 288.TP
3392325d 289\f3chattr\f1 [ \f2\-R\f1 | \f2\-D\f1 ] [ \f2+/\-riasAdtPn\f1 ]
48c46ee3 290Change extended inode flags on the currently open file.
3392325d
NS
291The \f2-R\f1 and \f2-D\f1 options have the same meaning as above.
292The mapping between each letter and the inode flags (refer to
293\f2xfsctl\f1(3) for the full list) is available via the \f3help\f1 command.
48c46ee3
NS
294.TP
295\f3freeze\f1
296Suspend all write I/O requests to the filesystem of the current file.
297Only available in expert mode and requires privileges.
298.TP
299\f3thaw\f1
300Undo the effects of a filesystem freeze operation.
301Only available in expert mode and requires privileges.
302.TP
303\f3inject\f1 [ \f2tag\f1 ]
304Inject errors into a filesystem to observe filesystem behavior at
305specific points under adverse conditions.
306Without an argument, displays the list of error tags available.
307Only available in expert mode and requires privileges.
308.TP
309\f3resblks\f1 [ \f2blocks\f1 ]
310Get and/or set count of reserved filesystem blocks using the
2a1888c5 311XFS_IOC_GET_RESBLKS or XFS_IOC_SET_RESBLKS system calls.
48c46ee3
NS
312Note \-\- this can be useful for exercising out of space behavior.
313Only available in expert mode and requires privileges.
314.TP
315\f3shutdown\f1 [ \f2\-f\f1 ]
316Force the filesystem to shutdown (with or without flushing the log).
317Only available in expert mode and requires privileges.
318.TP
319\f3stat\f1 [ \f2\-v\f1 ]
e246ba5f 320Selected statistics from \f2stat\f1(2) and the XFS_IOC_GETXATTR
2a1888c5 321system call on the current file.
e246ba5f
NS
322If the \f2-v\f1 option is specified, the atime (last access), mtime
323(last modify), and ctime (last change) timestamps are also displayed.
324.TP
325\f3statfs\f1
326Selected statistics from \f2statfs\f1(2) and the XFS_IOC_FSGEOMETRY
2a1888c5 327system call on the filesystem where the current file resides.
258b00ea
TS
328.TP
329\f3parent\f1 [ \f2\-cpv\f1 ]
330By default this command prints out the parent inode numbers,
331inode generation numbers and basenames of all the hardlinks which
332point to the inode of the current file.
333If the \f2-p\f1 option is specified, then the output is similar
334to the default output except pathnames up to the mount-point
335are printed out instead of the component name.
336If the \f2-c\f1 option is specified, then the file's filesystem
337will check all the parent attributes for consistency.
338If the \f2-v\f1 option is specified, then verbose output will be
339printed.
340Not currently operational on Linux.
2a1888c5
NS
341
342.SH IRIX SEE ALSO
343mkfs_xfs(1M),
344syssgi(2),
345xfs_bmap(1M),
346xfs_db(1M),
347xfs(4).
348
349.SH LINUX SEE ALSO
350mkfs.xfs(8),
351xfsctl(3),
352xfs_bmap(8),
353xfs_db(8),
354xfs(5).
48c46ee3 355
e246ba5f
NS
356.SH SEE ALSO
357fdatasync(2),
358fstat(2),
359fstatfs(2),
360fsync(2),
361ftruncate(2),
48c46ee3 362mmap(2),
e246ba5f
NS
363open(2),
364pread(2),
2a1888c5 365pwrite(2).