Debian Codegraph @

upstream/debian-trixie/man8/xfs_io.8

raw
1 .TH xfs_io 8
2 .SH NAME
3 xfs_io \- debug the I/O path of an XFS filesystem
4 .SH SYNOPSIS
5 .B xfs_io
6 [
7 .B \-adfimrRstxT
8 ] [
9 .B \-c
10 .I cmd
11 ] ... [
12 .B \-C
13 .I cmd
14 ] ... [
15 .B \-p
16 .I prog
17 ]
18 .I [ file ]
19 .br
20 .B xfs_io \-V
21 .SH DESCRIPTION
22 .B xfs_io
23 is a debugging tool like
24 .BR xfs_db (8),
25 but is aimed at examining the regular file I/O paths rather than the
26 raw XFS volume itself.
27 These code paths include not only the obvious read/write/mmap interfaces
28 for manipulating files, but also cover all of the XFS extensions (such
29 as space preallocation, additional inode flags, etc).
30 .SH OPTIONS
31 .B xfs_io
32 commands may be run interactively (the default) or as arguments on the
33 command line.
34 Interactive mode always runs commands on the current open file, whilst commands
35 run from the command line may be repeated on all open files rather than just the current
36 open file.
37 In general, open file iteration will occur for commands that operate on file
38 content or state. In contrast, commands that operate on filesystem or
39 system-wide state will only be run on the current file regardless of how many
40 files are currently open.
41 Multiple arguments may be given on the command line and they are run in the
42 sequence given. The program exits one all commands have
43 been run.
44 .TP 1.0i
45 .BI \-c " cmd"
46 Run the specified command on all currently open files.
47 To maintain compatibility with historical usage, commands that can not be run on
48 all open files will still be run but only execute once on the current open file.
49 Multiple
50 .B \-c
51 arguments may be given and may be interleaved on the command line in any order
52 with
53 .B \-C
54 commands.
55 .TP
56 .BI \-C " cmd"
57 Run the specified command only on the current open file.
58 Multiple
59 .B \-C
60 arguments may be given and may be interleaved on the command line in any order
61 with
62 .B \-c
63 commands.
64 .TP
65 .BI \-p " prog"
66 Set the program name for prompts and some error messages,
67 the default value is
68 .BR xfs_io .
69 .TP
70 .B \-f
71 Create
72 .I file
73 if it does not already exist.
74 .TP
75 .B \-r
76 Open
77 .I file
78 read-only, initially. This is required if
79 .I file
80 is immutable or append-only.
81 .TP
82 .B \-i
83 Start an idle thread. The purpose of this idle thread is to test io
84 from a multi threaded process. With single threaded process,
85 the file table is not shared and file structs are not reference counted.
86 Spawning an idle thread can help detecting file struct reference leaks.
87 .TP
88 .B \-x
89 Expert mode. Dangerous commands are only available in this mode.
90 These commands also tend to require additional privileges.
91 .TP
92 .B \-V
93 Prints the version number and exits.
94 .PP
95 The other
96 .BR open (2)
97 options described below are also available from the command line.
98 .SH CONCEPTS
99 .B xfs_io
100 maintains a number of open files and memory mappings.
101 Files can be initially opened on the command line (optionally),
102 and additional files can also be opened later.
103 .PP
104 .B xfs_io
105 commands can be broken up into three groups.
106 Some commands are aimed at doing regular file I/O - read, write,
107 sync, space preallocation, etc.
108 .PP
109 The second set of commands exist for manipulating memory mapped regions
110 of a file - mapping, accessing, storing, unmapping, flushing, etc.
111 .PP
112 The remaining commands are for the navigation and display of data
113 structures relating to the open files, mappings, and the filesystems
114 where they reside.
115 .PP
116 Many commands have extensive online help. Use the
117 .B help
118 command for more details on any command.
119 .SH FILE I/O COMMANDS
120 .TP
121 .BI "file [ " N " ]"
122 Display a list of all open files and (optionally) switch to an alternate
123 current open file.
124 .TP
125 .BI "open [[ \-acdfrstRTPL ] " path " ]"
126 Closes the current file, and opens the file specified by
127 .I path
128 instead. Without any arguments, displays statistics about the current
129 file \- see the
130 .B stat
131 command.
132 .RS 1.0i
133 .PD 0
134 .TP 0.4i
135 .B \-a
136 opens append-only (O_APPEND).
137 .TP
138 .B \-d
139 opens for direct I/O (O_DIRECT).
140 .TP
141 .B \-f
142 creates the file if it doesn't already exist (O_CREAT).
143 .TP
144 .B \-r
145 opens read-only (O_RDONLY).
146 .TP
147 .B \-s
148 opens for synchronous I/O (O_SYNC).
149 .TP
150 .B \-t
151 truncates on open (O_TRUNC).
152 .TP
153 .B \-n
154 opens in non-blocking mode if possible (O_NONBLOCK).
155 .TP
156 .B \-T
157 create a temporary file not linked into the filesystem namespace
158 (O_TMPFILE). The pathname passed must refer to a directory which
159 is treated as virtual parent for the newly created invisible file.
160 Can not be used together with the
161 .B \-r
162 option.
163 .TP
164 .B \-R
165 marks the file as a realtime XFS file after
166 opening it, if it is not already marked as such.
167 .TP
168 .B \-P
169 opens the path as a referent only (O_PATH). This is incompatible with other
170 flags specifying other O_xxx flags apart from
171 .BR \-L .
172 .TP
173 .B \-L
174 doesn't follow symlinks (O_NOFOLLOW). This is incompatible with other
175 flags specifying other O_xxx flags apart from
176 .BR \-P .
177 .PD
178 .RE
179 .TP
180 .B o
181 See the
182 .B open
183 command.
184 .TP
185 .B close
186 Closes the current open file, marking the next open file as current
187 (if one exists).
188 .TP
189 .B c
190 See the
191 .B close
192 command.
193 .TP
194 .B chmod \-r | \-w
195 Change the mode of the currently open file. The
196 .B \-r
197 option will set the file permissions to read-only (0444), whilst the
198 .B \-w
199 option will set the file permissions to read-write (0644). This allows xfs_io to
200 set up mismatches between the file permissions and the open file descriptor
201 read/write mode to exercise permission checks inside various syscalls.
202 .TP
203 .BI "pread [ \-b " bsize " ] [ \-qv ] [ \-FBR [ \-Z " seed " ] ] [ \-V " vectors " ] " "offset length"
204 Reads a range of bytes in a specified blocksize from the given
205 .IR offset .
206 .RS 1.0i
207 .PD 0
208 .TP 0.4i
209 .B \-b
210 can be used to set the blocksize into which the
211 .BR read (2)
212 requests will be split. The default blocksize is 4096 bytes.
213 .TP
214 .B \-q
215 quiet mode, do not write anything to standard output.
216 .TP
217 .B \-v
218 dump the contents of the buffer after reading,
219 by default only the count of bytes actually read is dumped.
220 .TP
221 .B \-F
222 read the buffers in a forward sequential direction.
223 .TP
224 .B \-B
225 read the buffers in a reverse sequential direction.
226 .TP
227 .B \-R
228 read the buffers in the give range in a random order.
229 .TP
230 .B \-Z seed
231 specify the random number seed used for random reads.
232 .TP
233 .B \-V vectors
234 Use the vectored IO read syscall
235 .BR preadv (2)
236 with a number of blocksize length iovecs. The number of iovecs is set by the
237 .I vectors
238 parameter.
239 .PD
240 .RE
241 .TP
242 .B r
243 See the
244 .B pread
245 command.
246 .TP
247 .BI "pwrite [ \-i " file " ] [ \-qAdDwNOW ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-V " vectors " ] " "offset length"
248 Writes a range of bytes in a specified blocksize from the given
249 .IR offset .
250 The bytes written can be either a set pattern or read in from another
251 file before writing.
252 .RS 1.0i
253 .PD 0
254 .TP 0.4i
255 .B \-i
256 allows an input
257 .I file
258 to be specified as the source of the data to be written.
259 .TP
260 .B \-q
261 quiet mode, do not write anything to standard output.
262 .TP
263 .B \-d
264 causes direct I/O, rather than the usual buffered
265 I/O, to be used when reading the input file.
266 .TP
267 .B \-w
268 call
269 .BR fdatasync (2)
270 once all writes are complete (included in timing results)
271 .TP
272 .B \-N
273 Perform the
274 .BR pwritev2 (2)
275 call with
276 .IR RWF_NOWAIT .
277 .TP
278 .B \-D
279 Perform the
280 .BR pwritev2 (2)
281 call with
282 .IR RWF_DSYNC .
283 .TP
284 .B \-A
285 Perform the
286 .BR pwritev2 (2)
287 call with
288 .IR RWF_ATOMIC .
289 .TP
290 .B \-O
291 perform pwrite once and return the (maybe partial) bytes written.
292 .TP
293 .B \-W
294 call
295 .BR fsync (2)
296 once all writes are complete (included in timing results)
297 .TP
298 .B \-s
299 specifies the number of bytes to
300 .I skip
301 from the start of the input file before starting to read.
302 .TP
303 .B \-b
304 used to set the blocksize into which the
305 .BR write (2)
306 requests will be split. The default blocksize is 4096 bytes.
307 .TP
308 .B \-S
309 used to set the (repeated) fill pattern which
310 is used when the data to write is not coming from a file.
311 The default buffer fill pattern value is 0xcdcdcdcd.
312 .TP
313 .B \-F
314 write the buffers in a forward sequential direction.
315 .TP
316 .B \-B
317 write the buffers in a reverse sequential direction.
318 .TP
319 .B \-R
320 write the buffers in the give range in a random order.
321 .TP
322 .B \-Z seed
323 specify the random number seed used for random write
324 .TP
325 .B \-V vectors
326 Use the vectored IO write syscall
327 .BR pwritev (2)
328 with a number of blocksize length iovecs. The number of iovecs is set by the
329 .I vectors
330 parameter.
331 .RE
332 .PD
333 .TP
334 .B w
335 See the
336 .B pwrite
337 command.
338 .TP
339 .BI "bmap [ \-adelpv ] [ \-n " nx " ]"
340 Prints the block mapping for the current open file. Refer to the
341 .BR xfs_bmap (8)
342 manual page for complete documentation.
343 .TP
344 .BI "fiemap [ \-alv ] [ \-n " nx " ] [ " offset " [ " len " ]]"
345 Prints the block mapping for the current open file using the fiemap
346 ioctl. Options behave as described in the
347 .BR xfs_bmap (8)
348 manual page.
349 .PP
350 .RS
351 Optionally, this command also supports passing the start offset
352 from where to begin the mapping and the length of that region.
353 The kernel will return any full extents which intersect with the requested
354 range, and the
355 .B fiemap
356 command will print them in their entirety. If the requested range starts
357 or ends in a hole,
358 .B fiemap
359 will print the hole, truncated to the requested range.
360 .RE
361 .TP
362 .BI "extsize [ \-R | \-D ] [ " value " ]"
363 Display and/or modify the preferred extent size used when allocating
364 space for the currently open file. If the
365 .B \-R
366 option is specified, a recursive descent is performed
367 for all directory entries below the currently open file
368 .RB ( \-D
369 can be used to restrict the output to directories only).
370 If the target file is a directory, then the inherited extent size
371 is set for that directory (new files created in that directory
372 inherit that extent size).
373 The
374 .I value
375 should be specified in bytes, or using one of the usual units suffixes
376 (k, m, g, b, etc). The extent size is always reported in units of bytes.
377 .TP
378 .BI "cowextsize [ \-R | \-D ] [ " value " ]"
379 Display and/or modify the preferred copy-on-write extent size used
380 when allocating space for the currently open file. If the
381 .B \-R
382 option is specified, a recursive descent is performed
383 for all directory entries below the currently open file
384 .RB ( \-D
385 can be used to restrict the output to directories only).
386 If the target file is a directory, then the inherited CoW extent size
387 is set for that directory (new files created in that directory
388 inherit that CoW extent size).
389 The
390 .I value
391 should be specified in bytes, or using one of the usual units suffixes
392 (k, m, g, b, etc). The extent size is always reported in units of bytes.
393 .TP
394 .BI "allocsp " size " 0"
395 Sets the size of the file to
396 .I size
397 and zeroes any additional space allocated using the
398 XFS_IOC_ALLOCSP/XFS_IOC_FREESP system call described in the
399 .BR xfsctl (3)
400 manual page.
401 .B allocsp
402 and
403 .B freesp
404 do exactly the same thing.
405
406 These commands are no longer supported as of Linux 5.17.
407 .TP
408 .BI "freesp " size " 0"
409 See the
410 .B allocsp
411 command.
412 .TP
413 .BI "fadvise [ \-r | \-s | [[ \-d | \-n | \-w ] " "offset length " ]]
414 On platforms which support it, allows hints be given to the system
415 regarding the expected I/O patterns on the file.
416 The range arguments are required by some advise commands ([*] below), and
417 the others must have no range arguments.
418 With no arguments, the POSIX_FADV_NORMAL advice is implied (default readahead).
419 .RS 1.0i
420 .PD 0
421 .TP 0.4i
422 .B \-d
423 the data will not be accessed again in the near future (POSIX_FADV_DONTNEED[*]).
424 .TP
425 .B \-n
426 data will be accessed once and not be reused (POSIX_FADV_NOREUSE[*]).
427 .TP
428 .B \-r
429 expect access to data in random order (POSIX_FADV_RANDOM), which sets readahead to zero.
430 .TP
431 .B \-s
432 expect access to data in sequential order (POSIX_FADV_SEQUENTIAL),
433 which doubles the default readahead on the file.
434 .TP
435 .B \-w
436 advises the specified data will be needed again (POSIX_FADV_WILLNEED[*])
437 which forces the maximum readahead.
438 .RE
439 .PD
440 .TP
441 .B fdatasync
442 Calls
443 .BR fdatasync (2)
444 to flush the file's in-core data to disk.
445 .TP
446 .B fsync
447 Calls
448 .BR fsync (2)
449 to flush all in-core file state to disk.
450 .TP
451 .B s
452 See the
453 .B fsync
454 command.
455 .TP
456 .BI "sync_range [ \-a | \-b | \-w ] offset length "
457 On platforms which support it, allows control of syncing a range of the file to
458 disk. With no options, SYNC_FILE_RANGE_WRITE is implied on the range supplied.
459 .RS 1.0i
460 .PD 0
461 .TP 0.4i
462 .B \-a
463 wait for IO in the given range to finish after writing
464 (SYNC_FILE_RANGE_WAIT_AFTER).
465 .TP
466 .B \-b
467 wait for IO in the given range to finish before writing
468 (SYNC_FILE_RANGE_WAIT_BEFORE).
469 .TP
470 .B \-w
471 start writeback of dirty data in the given range (SYNC_FILE_RANGE_WRITE).
472 .RE
473 .PD
474 .TP
475 .B sync
476 Calls
477 .BR sync (2)
478 to flush all filesystems' in-core data to disk.
479 .TP
480 .B syncfs
481 Calls
482 .BR syncfs (2)
483 to flush this filesystem's in-core data to disk.
484 .TP
485 .BI resvsp " offset length"
486 Allocates reserved, unwritten space for part of a file using the
487 XFS_IOC_RESVSP system call described in the
488 .BR xfsctl (3)
489 manual page.
490 .TP
491 .BI unresvsp " offset length"
492 Frees reserved space for part of a file using the XFS_IOC_UNRESVSP
493 system call described in the
494 .BR xfsctl (3)
495 manual page.
496 .TP
497 .BI "falloc [ \-k ]" " offset length"
498 Allocates reserved, unwritten space for part of a file using the
499 fallocate routine as described in the
500 .BR fallocate (2)
501 manual page.
502 .RS 1.0i
503 .PD 0
504 .TP 0.4i
505 .B \-k
506 will set the FALLOC_FL_KEEP_SIZE flag as described in
507 .BR fallocate (2).
508 .PD
509 .RE
510 .TP
511 .BI fcollapse " offset length"
512 Call fallocate with FALLOC_FL_COLLAPSE_RANGE flag as described in the
513 .BR fallocate (2)
514 manual page to de-allocates blocks and eliminates the hole created in this process
515 by shifting data blocks into the hole.
516 .TP
517 .BI finsert " offset length"
518 Call fallocate with FALLOC_FL_INSERT_RANGE flag as described in the
519 .BR fallocate (2)
520 manual page to create the hole by shifting data blocks.
521 .TP
522 .BI fpunch " offset length"
523 Punches (de-allocates) blocks in the file by calling fallocate with
524 the FALLOC_FL_PUNCH_HOLE flag as described in the
525 .BR fallocate (2)
526 manual page.
527 .TP
528 .BI funshare " offset length"
529 Call fallocate with FALLOC_FL_UNSHARE_RANGE flag as described in the
530 .BR fallocate (2)
531 manual page to unshare all shared blocks within the range.
532 .TP
533 .BI "fzero [ \-k ]" " offset length"
534 Call fallocate with FALLOC_FL_ZERO_RANGE flag as described in the
535 .BR fallocate (2)
536 manual page to allocate and zero blocks within the range.
537 With the
538 .B -k
539 option, use the FALLOC_FL_KEEP_SIZE flag as well.
540 .TP
541 .BI zero " offset length"
542 Call xfsctl with
543 .B XFS_IOC_ZERO_RANGE
544 as described in the
545 .BR xfsctl (3)
546 manual page to allocate and zero blocks within the range.
547 .TP
548 .BI truncate " offset"
549 Truncates the current file at the given offset using
550 .BR ftruncate (2).
551 .TP
552 .BI "sendfile [ \-q ] \-i " srcfile " | \-f " N " [ " "offset length " ]
553 On platforms which support it, allows a direct in-kernel copy between
554 two file descriptors. The current open file is the target, the source
555 must be specified as another open file
556 .RB ( \-f )
557 or by path
558 .RB ( \-i ).
559 .RS 1.0i
560 .B \-q
561 quiet mode, do not write anything to standard output.
562 .RE
563 .TP
564 .BI "readdir [ -v ] [ -o " offset " ] [ -l " length " ] "
565 Read a range of directory entries from a given offset of a directory.
566 .RS 1.0i
567 .PD 0
568 .TP 0.4i
569 .B \-v
570 verbose mode - dump dirent content as defined in
571 .BR readdir (3)
572 .TP
573 .B \-o
574 specify starting
575 .I offset
576 .TP
577 .B \-l
578 specify total
579 .I length
580 to read (in bytes)
581 .RE
582 .PD
583 .TP
584 .BI "seek \-a | \-d | \-h [ \-r ] [ \-s ] offset"
585 On platforms that support the
586 .BR lseek (2)
587 .B SEEK_DATA
588 and
589 .B SEEK_HOLE
590 options, display the offsets of the specified segments.
591 .RS 1.0i
592 .PD 0
593 .TP 0.4i
594 .B \-a
595 Display both
596 .B data
597 and
598 .B hole
599 segments starting at the specified
600 .B offset.
601 .TP
602 .B \-d
603 Display the
604 .B data
605 segment starting at the specified
606 .B offset.
607 .TP
608 .B \-h
609 Display the
610 .B hole
611 segment starting at the specified
612 .B offset.
613 .TP
614 .B \-r
615 Recursively display all the specified segments starting at the specified
616 .B offset.
617 .TP
618 .B \-s
619 Display the starting lseek(2) offset. This offset will be a calculated value when
620 both data and holes are displayed together or performing a recusively display.
621 .RE
622 .PD
623 .TP
624 .BI "reflink [ \-C ] [ \-q ] src_file [src_offset dst_offset length]"
625 On filesystems that support the
626 .B FICLONERANGE
627 or
628 .B BTRFS_IOC_CLONE_RANGE
629 ioctls, map
630 .I length
631 bytes at offset
632 .I dst_offset
633 in the open file to the same physical blocks that are mapped at offset
634 .I src_offset
635 in the file
636 .I src_file
637 , replacing any contents that may already have been there. If a program
638 writes into a reflinked block range of either file, the dirty blocks will be
639 cloned, written to, and remapped ("copy on write") in the affected file,
640 leaving the other file(s) unchanged. If src_offset, dst_offset, and length
641 are omitted, all contents of src_file will be reflinked into the open file.
642 .RS 1.0i
643 .PD 0
644 .TP 0.4i
645 .B \-C
646 Print timing statistics in a condensed format.
647 .TP
648 .B \-q
649 Do not print timing statistics at all.
650 .RE
651 .PD
652 .TP
653 .BI "dedupe [ \-C ] [ \-q ] src_file src_offset dst_offset length"
654 On filesystems that support the
655 .B FIDEDUPERANGE
656 or
657 .B BTRFS_IOC_FILE_EXTENT_SAME
658 ioctls, map
659 .I length
660 bytes at offset
661 .I dst_offset
662 in the open file to the same physical blocks that are mapped at offset
663 .I src_offset
664 in the file
665 .I src_file
666 , but only if the contents of both ranges are identical. This is known as
667 block-based deduplication. If a program writes into a reflinked block range of
668 either file, the dirty blocks will be cloned, written to, and remapped ("copy
669 on write") in the affected file, leaving the other file(s) unchanged.
670 .RS 1.0i
671 .PD 0
672 .TP 0.4i
673 .B \-C
674 Print timing statistics in a condensed format.
675 .TP
676 .B \-q
677 Do not print timing statistics at all.
678 .RE
679 .PD
680 .TP
681 .BI "copy_range [ -s " src_offset " ] [ -d " dst_offset " ] [ -l " length " ] src_file | \-f " N
682 On filesystems that support the
683 .BR copy_file_range (2)
684 system call, copies data from the source file into the current open file.
685 The source must be specified either by path
686 .RB ( src_file )
687 or as another open file
688 .RB ( \-f ).
689 If
690 .I length
691 is not specified, this command copies data from
692 .I src_offset
693 to the end of
694 .BI src_file
695 into the dst_file at
696 .IR dst_offset .
697 .RS 1.0i
698 .PD 0
699 .TP 0.4i
700 .B \-s
701 Copy data from
702 .I src_file
703 beginning from
704 .IR src_offset .
705 .TP
706 .B \-d
707 Copy data into the open file beginning at
708 .IR dst_offset .
709 .TP
710 .B \-l
711 Copy up to
712 .I length
713 bytes of data.
714 .RE
715 .PD
716 .TP
717 .BI swapext " donor_file "
718 Swaps extent forks between files. The current open file is the target. The donor
719 file is specified by path. Note that file data is not copied (file content moves
720 with the fork(s)).
721 .TP
722 .BI "exchangerange [OPTIONS]" donor_file "
723 Exchanges contents between files.
724 The current open file is the target.
725 The donor file is specified by path.
726 Note that file data is not copied (file content moves with the fork(s)).
727 Options include:
728 .RS 1.0i
729 .PD 0
730 .TP 0.4i
731 .TP
732 .B \-C
733 Print timing information in a condensed format.
734 .TP
735 .B \-c
736 Exchange contents only if file2 has not changed.
737 .TP
738 .BI \-d " dest_offset"
739 Swap extents with open file beginning at
740 .IR dest_offset .
741 .TP
742 .B \-f
743 Flush changed file data and file metadata to disk.
744 .TP
745 .BI \-l " length"
746 Swap up to
747 .I length
748 bytes of data.
749 .TP
750 .B \-n
751 Perform all the parameter validation checks but don't change anything.
752 .TP
753 .BI \-s " src_offset"
754 Swap extents with donor file beginning at
755 .IR src_offset .
756 .TP
757 .B \-t
758 Print timing information.
759 .TP
760 .B \-w
761 Only exchange written ranges in the supplied file.
762 .RE
763 .PD
764 .TP
765 .BI "set_encpolicy [ \-c " mode " ] [ \-n " mode " ] [ \-f " flags " ] [ \-s " log2_dusize " ] [ \-v " version " ] [ " keyspec " ]"
766 On filesystems that support encryption, assign an encryption policy to the
767 current file.
768 .I keyspec
769 is a hex string which specifies the encryption key to use. For v1 encryption
770 policies,
771 .I keyspec
772 must be a 16-character hex string (8 bytes). For v2 policies,
773 .I keyspec
774 must be a 32-character hex string (16 bytes). If unspecified, an all-zeroes
775 value is used.
776 .RS 1.0i
777 .PD 0
778 .TP 0.4i
779 .BI \-c " mode"
780 contents encryption mode (e.g. AES-256-XTS)
781 .TP
782 .BI \-n " mode"
783 filenames encryption mode (e.g. AES-256-CTS)
784 .TP
785 .BI \-f " flags"
786 policy flags (numeric)
787 .TP
788 .BI \-s " log2_dusize"
789 log2 of data unit size. Not supported by v1 policies.
790 .TP
791 .BI \-v " version"
792 policy version. Defaults to 1 or 2 depending on the length of
793 .IR keyspec ;
794 or to 1 if
795 .I keyspec
796 is unspecified.
797 .RE
798 .PD
799 .TP
800 .BI "get_encpolicy [ \-1 ] [ \-t ]"
801 On filesystems that support encryption, display the encryption policy of the
802 current file.
803 .RS 1.0i
804 .PD 0
805 .TP 0.4i
806 .BI \-1
807 Use only the old ioctl to get the encryption policy. This only works if the
808 file has a v1 encryption policy.
809 .TP
810 .BI \-t
811 Test whether v2 encryption policies are supported. Prints "supported",
812 "unsupported", or an error message.
813 .RE
814 .PD
815 .TP
816 .BI "add_enckey [ \-d " descriptor " ] [ \-k " key_id " ]"
817 On filesystems that support encryption, add an encryption key to the filesystem
818 containing the currently open file. By default, the raw key in binary
819 (typically 64 bytes long) is read from standard input.
820 .RS 1.0i
821 .PD 0
822 .TP 0.4i
823 .BI \-d " descriptor"
824 key descriptor, as a 16-character hex string (8 bytes). If given, the key will
825 be available for use by v1 encryption policies that use this descriptor.
826 Otherwise, the key is added as a v2 policy key, and on success the resulting
827 "key identifier" will be printed.
828 .TP
829 .BI \-k " key_id"
830 ID of kernel keyring key of type "fscrypt-provisioning". If given, the raw key
831 will be taken from here rather than from standard input.
832 .RE
833 .PD
834 .TP
835 .BI "rm_enckey [ -a ] " keyspec
836 On filesystems that support encryption, remove an encryption key from the
837 filesystem containing the currently open file.
838 .I keyspec
839 is a hex string specifying the key to remove, as a 16-character "key descriptor"
840 or a 32-character "key identifier".
841 .RS 1.0i
842 .PD 0
843 .TP 0.4i
844 .BI \-a
845 Remove the key for all users who have added it, not just the current user. This
846 is a privileged operation.
847 .RE
848 .PD
849 .TP
850 .BI "enckey_status " keyspec
851 On filesystems that support encryption, display the status of an encryption key.
852 .I keyspec
853 is a hex string specifying the key for which to display the status, as a
854 16-character "key descriptor" or a 32-character "key identifier".
855 .TP
856 .BR lsattr " [ " \-R " | " \-D " | " \-a " | " \-v " ]"
857 List extended inode flags on the currently open file. If the
858 .B \-R
859 option is specified, a recursive descent is performed
860 for all directory entries below the currently open file
861 .RB ( \-D
862 can be used to restrict the output to directories only).
863 This is a depth first descent, it does not follow symlinks and
864 it also does not cross mount points.
865
866 The current inode flag letters are documented below.
867 Please refer to the
868 .BR ioctl_xfs_fsgetxattr "(2)"
869 documentation for more details about what they mean.
870
871 .PD 0
872 .RS
873 .TP 0.5i
874 .B r
875 realtime file (XFS_XFLAG_REALTIME)
876
877 .TP
878 .B p
879 prealloc (XFS_XFLAG_PREALLOC)
880
881 .TP
882 .B i
883 immutable (XFS_XFLAG_IMMUTABLE)
884
885 .TP
886 .B a
887 append only (XFS_XFLAG_APPEND)
888
889 .TP
890 .B s
891 synchronous file writes (XFS_XFLAG_SYNC)
892
893 .TP
894 .B A
895 noatime (XFS_XFLAG_NOATIME)
896
897 .TP
898 .B d
899 nodump (XFS_XFLAG_NODUMP)
900
901 .TP
902 .B t
903 inherit realtime flag (XFS_XFLAG_RTINHERIT)"
904
905 .TP
906 .B P
907 inherit project id (XFS_XFLAG_PROJINHERIT)
908
909 .TP
910 .B n
911 no symlink creation (XFS_XFLAG_NOSYMLINKS)
912
913 .TP
914 .B e
915 extent size hint (XFS_XFLAG_EXTSIZE)
916
917 .TP
918 .B E
919 inherit extent size hint (XFS_XFLAG_EXTSZINHERIT)
920
921 .TP
922 .B f
923 nodefrag (XFS_XFLAG_NODEFRAG)
924
925 .TP
926 .B S
927 filestream allocator (XFS_XFLAG_FILESTREAM)
928
929 .TP
930 .B x
931 direct access persistent memory (XFS_XFLAG_DAX)
932
933 .TP
934 .B C
935 copy on write extent hint (XFS_XFLAG_COWEXTSIZE)
936
937 .TP
938 .B X
939 has extended attributes (XFS_XFLAG_HASATTR)
940 .RE
941
942 .TP
943 .BR chattr " [ " \-R " | " \-D " ] [ " + / \-riasAdtPneEfSxC " ]"
944 Change extended inode flags on the currently open file. The
945 .B \-R
946 and
947 .B \-D
948 options have the same meaning as above.
949
950 See the
951 .B lsattr
952 command above for the list of inode flag letters.
953
954 .TP
955 .BI "flink " path
956 Link the currently open file descriptor into the filesystem namespace.
957 .TP
958 .BR stat " [ " \-v "|" \-r " ]"
959 Selected statistics from
960 .BR stat (2)
961 and the XFS_IOC_GETXATTR system call on the current file. If the
962 .B \-v
963 option is specified, the atime (last access), mtime
964 (last modify), and ctime (last change) timestamps are also displayed. The
965 .B \-r
966 option dumps raw fields from the stat structure.
967 .TP
968 .BI "statx [ \-v|\-r ][ \-m " basic " | \-m " all " | -m " <mask> " ][ \-FD ]"
969 Selected statistics from
970 .BR stat (2)
971 and the XFS_IOC_GETXATTR system call on the current file.
972 .RS 1.0i
973 .PD 0
974 .TP 0.4i
975 .B \-v
976 Show timestamps.
977 .TP
978 .B \-r
979 Dump raw statx structure values.
980 .TP
981 .B \-m basic
982 Set the field mask for the statx call to STATX_BASIC_STATS.
983 .TP
984 .B \-m all
985 Set the the field mask for the statx call to STATX_ALL (default).
986 .TP
987 .B \-m <mask>
988 Specify a numeric field mask for the statx call.
989 .TP
990 .B \-F
991 Force the attributes to be synced with the server.
992 .TP
993 .B \-D
994 Don't sync attributes with the server.
995 .PD
996 .RE
997 .TP
998 .BR chproj " [ " \-R | \-D " ]"
999 Modifies the project identifier associated with the current path. The
1000 .B \-R
1001 option will recursively descend if the current path is a directory. The
1002 .B \-D
1003 option will also recursively descend, only setting modifying projects
1004 on subdirectories. See the
1005 .BR xfs_quota (8)
1006 manual page for more information about project identifiers.
1007 .TP
1008 .BR lsproj " [ " \-R | \-D " ]"
1009 Displays the project identifier associated with the current path. The
1010 .B \-R
1011 and
1012 .B \-D
1013 options behave as described above, in
1014 .B chproj.
1015 .TP
1016 .BR parent " [ " \-fpz " ] [ " \-b " bufsize ] [ " \-i " ino ] [ " \-n " name ] [" " ino gen " "]"
1017 By default this command prints out the parent inode numbers,
1018 inode generation numbers and basenames of all the hardlinks which
1019 point to the inode of the current file.
1020
1021 If the optional
1022 .B ino
1023 and
1024 .B gen
1025 parameters are provided, they will be used to create a file handle on the same
1026 filesystem as the open file.
1027 The parents of the file represented by the handle will be reported instead of
1028 the open file.
1029
1030 .RS 1.0i
1031 .PD 0
1032 .TP 0.4i
1033 .B \-b
1034 Use a buffer of this size to receive parent pointer records from the kernel.
1035 .TP 0.4i
1036 .B \-i
1037 Only show parent pointer records containing this inode number.
1038 .TP 0.4i
1039 .B \-n
1040 Only show parent pointer records containing this directory entry name.
1041 .TP 0.4i
1042 .B \-p
1043 the output is similar to the default output except pathnames up to
1044 the mount-point are printed out instead of the component name.
1045 .TP
1046 .B \-s
1047 Print records in short format: ino/gen/namelen/name
1048 .TP
1049 .B \-z
1050 Print only the first path from the root.
1051 .RE
1052 .PD
1053 .TP
1054 .BI utimes " atime_sec atime_nsec mtime_sec mtime_nsec"
1055 The utimes command changes the atime and mtime of the current file.
1056 sec uses UNIX timestamp notation and is the seconds elapsed since
1057 1970-01-01 00:00:00 UTC.
1058 nsec is the nanoseconds since the sec. This value needs to be in
1059 the range 0-999999999 with UTIME_NOW and UTIME_OMIT being exceptions.
1060 Each (sec, nsec) pair constitutes a single timestamp value.
1061 .TP
1062 .BI "startupdate [ " -e ]
1063 Create a temporary clone of a file in which to stage file updates.
1064 The
1065 .B \-e
1066 option creates an empty staging file.
1067 .TP
1068 .B cancelupdate
1069 Abandon changes from a update staging file.
1070 .TP
1071 .BI "commitupdate [" OPTIONS ]
1072 Commit changes from a update staging file to the real file.
1073 .RS 1.0i
1074 .PD 0
1075 .TP 0.4i
1076 .B \-C
1077 Print timing information in a condensed format.
1078 .TP 0.4i
1079 .B \-h
1080 Only swap ranges in the update staging file that were actually written.
1081 .TP 0.4i
1082 .B \-k
1083 Do not change file size.
1084 .TP 0.4i
1085 .B \-n
1086 Check parameters without changing anything.
1087 .TP 0.4i
1088 .B \-q
1089 Do not print timing information at all.
1090 .PD
1091 .RE
1092
1093 .SH MEMORY MAPPED I/O COMMANDS
1094 .TP
1095 .BI "mmap [ " N " | [[ \-rwxS ] [\-s " size " ] " "offset length " ]]
1096 With no arguments,
1097 .B mmap
1098 shows the current mappings. Specifying a single numeric argument
1099 .I N
1100 sets the current mapping. If two arguments are specified (a range specified by
1101 .I offset
1102 and
1103 .IR length ),
1104 a new mapping is created spanning the range, and the protection mode can
1105 be given as a combination of PROT_READ
1106 .RB ( \-r ),
1107 PROT_WRITE
1108 .RB ( \-w ),
1109 and PROT_EXEC
1110 .RB ( \-x ).
1111 The mapping will be created with the MAP_SHARED flag by default, or with the
1112 Linux specific (MAP_SYNC | MAP_SHARED_VALIDATE) flags if
1113 .B -S
1114 is given.
1115 .BI \-s " size"
1116 is used to do a mmap(size) && munmap(size) operation at first, try to reserve some
1117 extendible free memory space, if
1118 .I size
1119 is bigger than
1120 .I length
1121 parameter. But there's not guarantee that the memory after
1122 .I length
1123 ( up to
1124 .I size
1125 ) will stay free.
1126 .B e.g.
1127 "mmap -rw -s 8192 1024" will mmap 0 ~ 1024 bytes memory, but try to reserve 1024 ~ 8192
1128 free space(no guarantee). This free space will helpful for "mremap 8192" without
1129 MREMAP_MAYMOVE flag.
1130 .TP
1131 .B mm
1132 See the
1133 .B mmap
1134 command.
1135 .TP
1136 .BI "mremap [ \-f <new_address> ] [ \-m ] " new_length
1137 Changes the current mapping size to
1138 .IR new_length .
1139 Whether the mapping may be moved is controlled by the flags passed;
1140 MREMAP_FIXED
1141 .RB ( \-f ),
1142 or MREMAP_MAYMOVE
1143 .RB ( \-m ).
1144 .IR new_length
1145 specifies a page-aligned address to which the mapping must be moved. It
1146 can be set to 139946004389888, 4096k or 1g etc.
1147 .TP
1148 .B mrm
1149 See the
1150 .B mremap
1151 command.
1152 .TP
1153 .B munmap
1154 Unmaps the current memory mapping.
1155 .TP
1156 .B mu
1157 See the
1158 .B munmap
1159 command.
1160 .TP
1161 .BI "mread [ \-f | \-v ] [ \-r ] [" " offset length " ]
1162 Accesses a segment of the current memory mapping, optionally dumping it to
1163 the standard output stream (with
1164 .B \-v
1165 or
1166 .B \-f
1167 option) for inspection. The accesses are performed sequentially from the start
1168 .I offset
1169 by default, but can also be done from the end backwards through the
1170 mapping if the
1171 .B \-r
1172 option in specified.
1173 The two verbose modes differ only in the relative offsets they display, the
1174 .B \-f
1175 option is relative to file start, whereas
1176 .B \-v
1177 shows offsets relative to the start of the mapping.
1178 .TP
1179 .B mr
1180 See the
1181 .B mread
1182 command.
1183 .TP
1184 .BI "mwrite [ \-r ] [ \-S " seed " ] [ " "offset length " ]
1185 Stores a byte into memory for a range within a mapping.
1186 The default stored value is 'X', repeated to fill the range specified,
1187 but this can be changed using the
1188 .B \-S
1189 option.
1190 The memory stores are performed sequentially from the start offset by default,
1191 but can also be done from the end backwards through the mapping if the
1192 .B \-r
1193 option in specified.
1194 .TP
1195 .B mw
1196 See the
1197 .B mwrite
1198 command.
1199 .TP
1200 .BI "msync [ \-i ] [ \-a | \-s ] [ " "offset length " ]
1201 Writes all modified copies of pages over the specified range (or entire
1202 mapping if no range specified) to their backing storage locations.
1203 Also, optionally invalidates
1204 .RB ( \-i )
1205 so that subsequent references to the pages will be obtained from their
1206 backing storage locations (instead of cached copies).
1207 The flush can be done synchronously
1208 .RB ( \-s)
1209 or asynchronously
1210 .RB ( \-a ).
1211 .TP
1212 .B ms
1213 See the
1214 .B msync
1215 command.
1216 .TP
1217 .BI "madvise [ \-d | \-r | \-s | \-w ] [ " "offset length " ]
1218 Modifies page cache behavior when operating on the current mapping.
1219 The range arguments are required by some advise commands ([*] below).
1220 With no arguments, the POSIX_MADV_NORMAL advice is implied (default readahead).
1221 .RS 1.0i
1222 .PD 0
1223 .TP 0.4i
1224 .B \-d
1225 the pages will not be needed (POSIX_MADV_DONTNEED[*]).
1226 .TP
1227 .B \-r
1228 expect random page references (POSIX_MADV_RANDOM), which sets readahead to zero.
1229 .TP
1230 .B \-s
1231 expect sequential page references (POSIX_MADV_SEQUENTIAL),
1232 which doubles the default readahead on the file.
1233 .TP
1234 .B \-w
1235 advises the specified pages will be needed again (POSIX_MADV_WILLNEED[*])
1236 which forces the maximum readahead.
1237 .RE
1238 .PD
1239 .TP
1240 .B mincore
1241 Dumps a list of pages or ranges of pages that are currently in core,
1242 for the current memory mapping.
1243
1244 .SH FILESYSTEM COMMANDS
1245 .TP
1246 .BI "aginfo [ \-a " agno " ]"
1247 Show information about or update the state of allocation groups.
1248 .RE
1249 .RS 1.0i
1250 .PD 0
1251 .TP
1252 .BI \-a
1253 Act only on a specific allocation group.
1254 .PD
1255 .RE
1256
1257 .TP
1258 .BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-m ] [ \-n " batchsize " ] [ \-q ] [ \-s " startino " ] [ \-v " version" ]
1259 Display raw stat information about a bunch of inodes in an XFS filesystem.
1260 Options are as follows:
1261 .RS 1.0i
1262 .PD 0
1263 .TP
1264 .BI \-a " agno"
1265 Display only results from the given allocation group.
1266 If not specified, all results returned will be displayed.
1267 .TP
1268 .BI \-d
1269 Print debugging information about call results.
1270 .TP
1271 .BI \-e " endino"
1272 Stop displaying records when this inode number is reached.
1273 Defaults to stopping when the system call stops returning results.
1274 .TP
1275 .BI \-m
1276 Include metadata directories in the output.
1277 .TP
1278 .BI \-n " batchsize"
1279 Retrieve at most this many records per call.
1280 Defaults to 4,096.
1281 .TP
1282 .BI \-q
1283 Run quietly.
1284 Does not parse or output retrieved bulkstat information.
1285 .TP
1286 .BI \-s " startino"
1287 Display inode allocation records starting with this inode.
1288 Defaults to the first inode in the filesystem.
1289 If the given inode is not allocated, results will begin with the next allocated
1290 inode in the filesystem.
1291 .TP
1292 .BI \-v " version"
1293 Use a particular version of the kernel interface.
1294 Currently supported versions are 1 and 5.
1295 .RE
1296 .PD
1297 .TP
1298 .BI "bulkstat_single [ \-d ] [ \-m ] [ \-v " version " ] [ " inum... " | " special... " ]
1299 Display raw stat information about individual inodes in an XFS filesystem.
1300 The
1301 .BR \-d ,
1302 .BR \-m ,
1303 and
1304 .B \-v
1305 options are the same as the
1306 .B bulkstat
1307 command.
1308 Arguments must be inode numbers or any of the special values:
1309 .RS 1.0i
1310 .PD 0
1311 .TP
1312 .B root
1313 Display information about the root directory inode.
1314 .RE
1315 .PD
1316 .TP
1317 .B freeze
1318 Suspend all write I/O requests to the filesystem of the current file.
1319 Only available in expert mode and requires privileges.
1320 .TP
1321 .B thaw
1322 Undo the effects of a filesystem freeze operation.
1323 Only available in expert mode and requires privileges.
1324 .TP
1325 .BI "inject [ " tag " ]"
1326 Inject errors into a filesystem to observe filesystem behavior at
1327 specific points under adverse conditions. Without the
1328 .I tag
1329 argument, displays the list of error tags available.
1330 Only available in expert mode and requires privileges.
1331
1332 .TP
1333 .BI "rginfo [ \-r " rgno " ]"
1334 Show information about or update the state of realtime allocation groups.
1335 .RE
1336 .RS 1.0i
1337 .PD 0
1338 .TP
1339 .BI \-r
1340 Act only on a specific realtime group.
1341 .PD
1342 .RE
1343
1344 .TP
1345 .BI "resblks [ " blocks " ]"
1346 Get and/or set count of reserved filesystem blocks using the
1347 XFS_IOC_GET_RESBLKS or XFS_IOC_SET_RESBLKS system calls.
1348 Note \-\- this can be useful for exercising out of space behavior.
1349 Only available in expert mode and requires privileges.
1350 .TP
1351 .BR shutdown " [ " \-f " ]"
1352 Force the filesystem to shut down, preventing any further IO.
1353 XFS and other filesystems implement this functionality, although implementation
1354 details may differ slightly.
1355 Only available in expert mode and requires privileges.
1356 .PP
1357 .RS
1358 By default, the filesystem will not attempt to flush completed transactions to
1359 disk before shutting down the filesystem. This simulates a disk failure or
1360 crash.
1361 .RE
1362 .RS 1.0i
1363 .PD 0
1364 .TP 0.4i
1365 .B \-f
1366 Force the filesystem to flush all completed transactions to disk before shutting
1367 down, matching XFS behavior when critical corruption is encountered.
1368 .PD
1369 .RE
1370 .TP
1371 .B statfs [ -c ] [ -g ] [ -s ]
1372 Report selected statistics on the filesystem where the current file resides.
1373 The default behavior is to enable all three reporting options:
1374 .RS 1.0i
1375 .PD 0
1376 .TP
1377 .BI \-c
1378 Display
1379 .B XFS_IOC_FSCOUNTERS
1380 summary counter data.
1381 .TP
1382 .BI \-g
1383 Display
1384 .B XFS_IOC_FSGEOMETRY
1385 filesystem geometry data.
1386 .TP
1387 .BI \-s
1388 Display
1389 .BR statfs (2)
1390 data.
1391 .TP
1392 .RE
1393 .PD
1394 .TP
1395 .BI "inode [ [ -n ] " number " ] [ -v ]"
1396 The inode command queries physical information about an inode. With
1397 no arguments, it will return 1 or 0, indicating whether or not any
1398 inode numbers greater than 32 bits are currently in use in the filesystem.
1399 If given an inode
1400 .I number
1401 as an argument, the command will return the same inode
1402 .I number
1403 if it is in use, or 0 if not. With
1404 .BI \-n " number"
1405 , the next used inode number after this
1406 .I number
1407 will be returned, or zero if the supplied inode number is the highest one
1408 in use. With
1409 .B \-v
1410 the command will also report the number of bits (32 or 64) used by the
1411 inode
1412 .I number
1413 printed in the result; if no inode
1414 .I number
1415 was specified on the command line, the maximum possible inode number in
1416 the system will be printed along with its size.
1417 .PD
1418 .TP
1419 .BI "inumbers [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-s " startino " ] [ \-v " version " ]
1420 Prints allocation information about groups of inodes in an XFS filesystem.
1421 Callers can use this information to figure out which inodes are allocated.
1422 Options are as follows:
1423 .RS 1.0i
1424 .PD 0
1425 .TP
1426 .BI \-a " agno"
1427 Display only results from the given allocation group.
1428 If not specified, all results returned will be displayed.
1429 .TP
1430 .BI \-d
1431 Print debugging information about call results.
1432 .TP
1433 .BI \-e " endino"
1434 Stop displaying records when this inode number is reached.
1435 Defaults to stopping when the system call stops returning results.
1436 .TP
1437 .BI \-n " batchsize"
1438 Retrieve at most this many records per call.
1439 Defaults to 4,096.
1440 .TP
1441 .BI \-s " startino"
1442 Display inode allocation records starting with this inode.
1443 Defaults to the first inode in the filesystem.
1444 If the given inode is not allocated, results will begin with the next allocated
1445 inode in the filesystem.
1446 .TP
1447 .BI \-v " version"
1448 Use a particular version of the kernel interface.
1449 Currently supported versions are 1 and 5.
1450 .RE
1451 .PD
1452 .TP
1453 .BI "scrub " type " [ " agnumber " | " rgnumber " | " "ino" " " "gen" " | " metapath " [ " rgnumber " ] ]"
1454 Scrub internal XFS filesystem metadata. The
1455 .BI type
1456 parameter specifies which type of metadata to scrub.
1457 For AG metadata, one AG number must be specified.
1458 For realtime group metadata, one rtgroup number must be specified.
1459 For file metadata, the scrub is applied to the open file unless the
1460 inode number and generation number are specified.
1461 For metapath, the name of a file or a raw number must be specified.
1462 If the metapath file is a per-rtgroup file, the group number must be specified.
1463 .RE
1464 .PD
1465 .TP
1466 .BI "scrubv [ \-b NN ] [ \-d ] [ \-m oflags ] [ \-r ] [ \-v NN ] [ \-w ms ] " group " [ " agnumber " | " "ino" " " "gen" " ]"
1467 Scrub a bunch of internal XFS filesystem metadata.
1468 The
1469 .BI group
1470 parameter specifies which group of metadata to scrub.
1471 Valid groups are
1472 .IR ag ", " agheader ", " inode ", " iscan ", " fs ", " probe ", " rtgroup ", or " summary .
1473
1474 For
1475 .BR ag " and " agheader
1476 metadata, one AG number must be specified.
1477 For
1478 .B inode
1479 metadata, the scrub is applied to the open file unless the
1480 inode number and generation number are specified.
1481 For
1482 .B rtgroup
1483 metadata, one rt group number must be specified.
1484
1485 .RS 1.0i
1486 .PD 0
1487 .TP
1488 .BI "\-b " NN
1489 Inject scrub barriers into the vector stream at the given interval.
1490 Barriers abort vector processing if any previous scrub function found
1491 corruption.
1492 .TP
1493 .BI \-d
1494 Enables debug mode.
1495 .TP
1496 .BI \-m
1497 Fail scrub barriers if any of these scrub output flags are seen.
1498 .TP
1499 .BI \-r
1500 Repair metadata if corruptions are found.
1501 This option requires expert mode.
1502 .TP
1503 .BI "\-v " NN
1504 Force a particular API version.
1505 .B single
1506 selects XFS_SCRUB_METADATA (one-by-one).
1507 .B vector
1508 selects XFS_SCRUBV_METADATA (vectored).
1509 If no option is specified, vector mode will be used, with a fallback to single
1510 mode if the kernel doesn't recognize the vector mode ioctl.
1511 .TP
1512 .BI "\-w " us
1513 Wait the given number of microseconds between each scrub function.
1514 .RE
1515 .PD
1516 .TP
1517 .BI "repair " type " [ " agnumber " | " "ino" " " "gen" " ]"
1518 Repair internal XFS filesystem metadata. The
1519 .BI type
1520 parameter specifies which type of metadata to repair.
1521 For AG metadata, one AG number must be specified.
1522 For file metadata, the repair is applied to the open file unless the
1523 inode number and generation number are specified.
1524 The
1525 .B -R
1526 option can be specified to force rebuilding of a metadata structure.
1527 .TP
1528 .BI "label" " " "[ -c | -s " label " ] "
1529 On filesystems that support online label manipulation, get, set, or clear the
1530 filesystem label. With no options, print the current filesystem label. The
1531 .B \-c
1532 option clears the filesystem label by setting it to the null string. The
1533 .BI "\-s " label
1534 option sets the filesystem label to
1535 .IR label .
1536 If the label is longer than the filesystem will accept,
1537 .B xfs_io
1538 will print an error message. XFS filesystem labels can be at most 12
1539 characters long.
1540 .TP
1541 .BI "fsmap [ \-d | \-l | \-r ] [ \-m | \-v ] [ \-n " nx " ] [ " start " ] [ " end " ]
1542 Prints the mapping of disk blocks used by the filesystem hosting the current
1543 file. The map lists each extent used by files, allocation group metadata,
1544 journalling logs, and static filesystem metadata, as well as any
1545 regions that are unused.
1546 Each line of the listings takes the following form:
1547 .PP
1548 .RS
1549 .IR extent ": " major ":" minor " [" startblock .. endblock "]: " owner " " startoffset .. endoffset " " length
1550 .PP
1551 Static filesystem metadata, allocation group metadata, btrees,
1552 journalling logs, and free space are marked by replacing the
1553 .IR startoffset .. endoffset
1554 with the appropriate marker.
1555 All blocks, offsets, and lengths are specified in units of 512-byte
1556 blocks, no matter what the filesystem's block size is.
1557 The optional
1558 .I start
1559 and
1560 .I end
1561 arguments can be used to constrain the output to a particular range of
1562 disk blocks.
1563 If these two options are specified, exactly one of
1564 .BR "-d" ", " "-l" ", or " "-r"
1565 must also be set.
1566 .RE
1567 .RS 1.0i
1568 .PD 0
1569 .TP
1570 .BI \-d
1571 Display only extents from the data device.
1572 This option only applies for XFS filesystems.
1573 .TP
1574 .BI \-l
1575 Display only extents from the external log device.
1576 This option only applies to XFS filesystems.
1577 .TP
1578 .BI \-r
1579 Display only extents from the realtime device.
1580 This option only applies to XFS filesystems.
1581 .TP
1582 .BI \-m
1583 Display results in a machine readable format (CSV).
1584 This option is not compatible with the
1585 .B \-v
1586 flag.
1587 The columns of the output are: extent number, device major, device minor,
1588 physical start, physical end, owner, offset start, offset end, length.
1589 The start, end, and length numbers are provided in units of 512b.
1590 The owner field is a special string that takes the form:
1591
1592 .RS 1.0i
1593 .PD 0
1594 .TP 0.4i
1595 .I inode_%lld_data
1596 for inode data.
1597 .TP
1598 .I inode_%lld_data_bmbt
1599 for inode data extent maps.
1600 .TP
1601 .I inode_%lld_attr
1602 for inode extended attribute data.
1603 .TP
1604 .I inode_%lld_attr_bmbt
1605 for inode extended attribute extent maps.
1606 .TP
1607 .I special_%u:%u
1608 for other filesystem metadata.
1609 .PD
1610 .RE
1611
1612 .TP
1613 .BI \-n " num_extents"
1614 If this option is given,
1615 .B fsmap
1616 obtains the extent list of the file in groups of
1617 .I num_extents
1618 extents.
1619 In the absence of
1620 .BR "-n" ", " "fsmap"
1621 queries the system for extents in groups of 131,072 records.
1622 .TP
1623 .B \-v
1624 Shows verbose information.
1625 When this flag is specified, additional AG specific information is
1626 appended to each line in the following form:
1627 .IP
1628 .RS 1.2i
1629 .IR agno " (" startagblock .. endagblock ") " nblocks " " flags
1630 .RE
1631 .IP
1632 A second
1633 .B \-v
1634 option will print out the
1635 .I flags
1636 legend.
1637 This option is not compatible with the
1638 .B \-m
1639 flag.
1640 .RE
1641 .PD
1642 .TP
1643 .B fsuuid
1644 Print the mounted filesystem UUID.
1645 .TP
1646 .B sysfspath
1647 Print the sysfs or debugfs path for the mounted filesystem.
1648
1649 The
1650 .B -d
1651 option selects debugfs instead of sysfs.
1652 .TP
1653 .BI "getfsprops " name " [ " names "... ]"
1654 Retrieve the values of the given filesystem properties.
1655 .TP
1656 .BI "listfsprops [ " \-v " ]"
1657 List all filesystem properties that have been stored in the filesystem.
1658 If the
1659 .B \-v
1660 flag is specified, prints the values of the properties.
1661 .TP
1662 .BI "setfsprops " name = value " [ " name = value "... ]"
1663 Set the given filesystem properties to the specified values.
1664 .TP
1665 .BI "removefsprops " name " [ " names "... ]"
1666 Remove the given filesystem properties.
1667
1668 .SH OTHER COMMANDS
1669 .TP
1670 .BR "help [ " command " ]"
1671 Display a brief description of one or all commands.
1672 .TP
1673 .B print
1674 Display a list of all open files and memory mapped regions.
1675 The current file and current mapping are distinguishable from
1676 any others.
1677 .TP
1678 .B p
1679 See the
1680 .B print
1681 command.
1682 .TP
1683 .B quit
1684 Exit
1685 .BR xfs_io .
1686 .TP
1687 .B q
1688 See the
1689 .B quit
1690 command.
1691 .TP
1692 .BI "log_writes \-d " device " \-m " mark
1693 Create a mark named
1694 .I mark
1695 in the dm-log-writes log specified by
1696 .I device.
1697 This is intended to be equivalent to the shell command:
1698
1699 .B dmsetup message
1700 .I device
1701 .B 0 mark
1702 .I mark
1703 .PD
1704 .RE
1705 .TP
1706 .B lw
1707 See the
1708 .B log_writes
1709 command.
1710 .TP
1711 .B crc32cselftest
1712 Test the internal crc32c implementation to make sure that it computes results
1713 correctly.
1714 .SH SEE ALSO
1715 .BR mkfs.xfs (8),
1716 .BR xfsctl (3),
1717 .BR xfs_bmap (8),
1718 .BR xfs_db (8),
1719 .BR xfs (5),
1720 .BR fdatasync (2),
1721 .BR fstat (2),
1722 .BR fstatfs (2),
1723 .BR fsync (2),
1724 .BR ftruncate (2),
1725 .BR futimens (3),
1726 .BR mmap (2),
1727 .BR msync (2),
1728 .BR open (2),
1729 .BR pread (2),
1730 .BR pwrite (2),
1731 .BR readdir (3),
1732 .BR dmsetup (8).