1xfs_fsr(8) System Manager's Manual xfs_fsr(8)
2
3
4
6 xfs_fsr - filesystem reorganizer for XFS
7
9 xfs_fsr [-vdg] [-t seconds] [-p passes] [-f leftoff] [-m mtab]
10 xfs_fsr [-vdg] [xfsdev | file] ...
11 xfs_fsr -V
12
14 xfs_fsr is applicable only to XFS filesystems.
15
16 xfs_fsr improves the organization of mounted filesystems. The reorga‐
17 nization algorithm operates on one file at a time, compacting or other‐
18 wise improving the layout of the file extents (contiguous blocks of
19 file data).
20
21 The following options are accepted by xfs_fsr. The -m, -t, and -f
22 options have no meaning if any filesystems or files are specified on
23 the command line.
24
25 -m mtab Use this file for the list of filesystems to reorganize.
26 The default is to use /etc/mtab.
27
28 -t seconds How long to reorganize. The default is 7200 seconds (2
29 hours).
30
31 -p passes Number of passes before terminating global re-org. The
32 default is 10 passes.
33
34 -f leftoff Use this file instead of /var/tmp/.fsrlast to read the
35 state of where to start and as the file to store the state
36 of where reorganization left off.
37
38 -v Verbose. Print cryptic information about each file being
39 reorganized.
40
41 -d Debug. Print even more cryptic information.
42
43 -g Print to syslog (default if stdout not a tty).
44
45 -V Prints the version number and exits.
46
47
48 When invoked with no arguments xfs_fsr reorganizes all regular files in
49 all mounted filesystems. xfs_fsr makes many cycles over /etc/mtab each
50 time making a single pass over each XFS filesystem. Each pass goes
51 through and selects files that have the largest number of extents. It
52 attempts to defragment the top 10% of these files on each pass.
53
54 It runs for up to two hours after which it records the filesystem where
55 it left off, so it can start there the next time. This information is
56 stored in the file /var/tmp/.fsrlast_xfs. If the information found
57 here is somehow inconsistent or out of date it is ignored and reorgani‐
58 zation starts at the beginning of the first filesystem found in
59 /etc/mtab.
60
61 xfs_fsr can be called with one or more arguments naming filesystems
62 (block device name), and files to reorganize. In this mode xfs_fsr
63 does not read or write /var/tmp/.fsrlast_xfs nor does it run for a
64 fixed time interval. It makes one pass through each specified regular
65 file and all regular files in each specified filesystem. A command
66 line name referring to a symbolic link (except to a file system
67 device), FIFO, or UNIX domain socket generates a warning message, but
68 is otherwise ignored. While traversing the filesystem these types of
69 files are silently skipped.
70
72 /etc/mtab contains default list of filesystems to reorga‐
73 nize.
74 /var/tmp/.fsrlast_xfs
75 records the state where reorganization left off.
76
78 xfs_fsr(8), mkfs.xfs(8), xfs_ncheck(8), xfs(5).
79
81 xfs_fsr improves the layout of extents for each file by copying the
82 entire file to a temporary location and then interchanging the data
83 extents of the target and temporary files in an atomic manner. This
84 method requires that enough free disk space be available to copy any
85 given file and that the space be less fragmented than the original
86 file. It also requires the owner of the file to have enough remaining
87 filespace quota to do the copy on systems running quotas. xfs_fsr gen‐
88 erates a warning message if space is not sufficient to improve the tar‐
89 get file.
90
91 A temporary file used in improving a file given on the command line is
92 created in the same parent directory of the target file and is prefixed
93 by the string '.fsr'. The temporary files used in improving an entire
94 XFS device are stored in a directory at the root of the target device
95 and use the same naming scheme. The temporary files are unlinked upon
96 creation so data will not be readable by any other process.
97
98 xfs_fsr does not operate on files that are currently mapped in memory.
99 A 'file busy' error can be seen for these files if the verbose flag
100 (-v) is set.
101
102 Files marked as no-defrag will be skipped. The xfs_io(8) chattr command
103 with the f attribute can be used to set or clear this flag. Files and
104 directories created in a directory with the no-defrag flag will inherit
105 the attribute.
106
107 An entry in /etc/mtab or the file specified using the -m option must
108 have the rw option specified for read and write access. If this option
109 is not present, then xfs_fsr skips the filesystem described by that
110 line. See the fstab(5) reference page for more details.
111
112 In general we do not foresee the need to run xfs_fsr on system parti‐
113 tions such as /, /boot and /usr as in general these will not suffer
114 from fragmentation. There are also issues with defragmenting files
115 lilo(8) uses to boot your system. It is recommended that these files
116 should be flagged as no-defrag with the xfs_io(8) chattr command.
117 Should these files be moved by xfs_fsr then you must rerun lilo before
118 you reboot or you may have an unbootable system.
119
120
121
122 xfs_fsr(8)