| 1 |
.TH xfs_fsr 8 |
| 2 |
.SH NAME |
| 3 |
xfs_fsr \- filesystem reorganizer for XFS |
| 4 |
.SH SYNOPSIS |
| 5 |
.nf |
| 6 |
\f3xfs_fsr\f1 [\f3\-vdg\f1] \c |
| 7 |
[\f3\-t\f1 seconds] [\f3\-p\f1 passes] [\f3\-f\f1 leftoff] [\f3\-m\f1 mtab] |
| 8 |
\f3xfs_fsr\f1 [\f3\-vdg\f1] \c |
| 9 |
[xfsdev | file] ... |
| 10 |
.br |
| 11 |
.B xfs_fsr \-V |
| 12 |
.fi |
| 13 |
.SH DESCRIPTION |
| 14 |
.I xfs_fsr |
| 15 |
is applicable only to XFS filesystems. |
| 16 |
.PP |
| 17 |
.I xfs_fsr |
| 18 |
improves the organization of mounted filesystems. |
| 19 |
The reorganization algorithm operates on one file at a time, |
| 20 |
compacting or otherwise improving the layout of |
| 21 |
the file extents (contiguous blocks of file data). |
| 22 |
.PP |
| 23 |
The following options are accepted by |
| 24 |
.IR xfs_fsr . |
| 25 |
The |
| 26 |
.BR \-m , |
| 27 |
.BR \-t , |
| 28 |
and |
| 29 |
.B \-f |
| 30 |
options have no meaning if any filesystems |
| 31 |
or files are specified on the command line. |
| 32 |
.TP 13 |
| 33 |
.BI \-m " mtab" |
| 34 |
Use this file for the list of filesystems to reorganize. |
| 35 |
The default is to use |
| 36 |
.IR /etc/mtab . |
| 37 |
.TP |
| 38 |
.BI \-t " seconds" |
| 39 |
How long to reorganize. |
| 40 |
The default is 7200 seconds (2 hours). |
| 41 |
.TP |
| 42 |
.BI \-p " passes" |
| 43 |
Number of passes before terminating global re-org. |
| 44 |
The default is 10 passes. |
| 45 |
.TP |
| 46 |
.BI \-f " leftoff" |
| 47 |
Use this file instead of |
| 48 |
.I /var/tmp/.fsrlast |
| 49 |
to read the state of where to start and as the file |
| 50 |
to store the state of where reorganization left off. |
| 51 |
.TP |
| 52 |
.B \-v |
| 53 |
Verbose. |
| 54 |
Print cryptic information about |
| 55 |
each file being reorganized. |
| 56 |
.TP |
| 57 |
.B \-d |
| 58 |
Debug. Print even more cryptic information. |
| 59 |
.TP |
| 60 |
.B \-g |
| 61 |
Print to syslog (default if stdout not a tty). |
| 62 |
.TP |
| 63 |
.B \-V |
| 64 |
Prints the version number and exits. |
| 65 |
|
| 66 |
.PP |
| 67 |
When invoked with no arguments |
| 68 |
.I xfs_fsr |
| 69 |
reorganizes all regular files in all mounted filesystems. |
| 70 |
.I xfs_fsr |
| 71 |
makes many cycles over |
| 72 |
.I /etc/mtab |
| 73 |
each time making a single pass over each XFS filesystem. |
| 74 |
Each pass goes through and selects files |
| 75 |
that have the largest number of extents. It attempts |
| 76 |
to defragment the top 10% of these files on each pass. |
| 77 |
.PP |
| 78 |
It runs for up to two hours after which it records the filesystem |
| 79 |
where it left off, so it can start there the next time. |
| 80 |
This information is stored in the file |
| 81 |
.I /var/tmp/.fsrlast_xfs. |
| 82 |
If the information found here |
| 83 |
is somehow inconsistent or out of date |
| 84 |
it is ignored |
| 85 |
and reorganization starts at the beginning of the first |
| 86 |
filesystem found in |
| 87 |
.IR /etc/mtab . |
| 88 |
.PP |
| 89 |
.I xfs_fsr |
| 90 |
can be called with one or more arguments |
| 91 |
naming filesystems (block device name), |
| 92 |
and files to reorganize. |
| 93 |
In this mode |
| 94 |
.I xfs_fsr |
| 95 |
does not read or write |
| 96 |
.I /var/tmp/.fsrlast_xfs |
| 97 |
nor does it run for a fixed time interval. |
| 98 |
It makes one pass through each specified regular file and |
| 99 |
all regular files in each specified filesystem. |
| 100 |
A command line name referring to a symbolic link |
| 101 |
(except to a file system device), |
| 102 |
FIFO, or UNIX domain socket |
| 103 |
generates a warning message, but is otherwise ignored. |
| 104 |
While traversing the filesystem these types |
| 105 |
of files are silently skipped. |
| 106 |
.SH FILES |
| 107 |
.PD 0 |
| 108 |
.TP 21 |
| 109 |
/etc/mtab |
| 110 |
contains default list of filesystems to reorganize. |
| 111 |
.TP 21 |
| 112 |
/var/tmp/.fsrlast_xfs |
| 113 |
records the state where reorganization left off. |
| 114 |
.PD |
| 115 |
.SH "SEE ALSO" |
| 116 |
xfs_fsr(8), |
| 117 |
mkfs.xfs(8), |
| 118 |
xfs_ncheck(8), |
| 119 |
xfs(5). |
| 120 |
.SH "NOTES" |
| 121 |
.I xfs_fsr |
| 122 |
improves the layout of extents for each file by copying the entire |
| 123 |
file to a temporary location and then interchanging the data extents |
| 124 |
of the target and temporary files in an atomic manner. |
| 125 |
This method requires that enough free disk space be available to copy |
| 126 |
any given file and that the space be less fragmented than the original |
| 127 |
file. |
| 128 |
It also requires the owner of the file to have enough remaining |
| 129 |
filespace quota to do the copy on systems running quotas. |
| 130 |
.I xfs_fsr |
| 131 |
generates a warning message if space is not sufficient to improve |
| 132 |
the target file. |
| 133 |
.PP |
| 134 |
A temporary file used in improving a file given on the command line |
| 135 |
is created in the same parent directory of the target file and |
| 136 |
is prefixed by the string '\f3.fsr\f1'. |
| 137 |
The temporary files used in improving an entire XFS device are stored |
| 138 |
in a directory at the root of the target device and use the same |
| 139 |
naming scheme. |
| 140 |
The temporary files are unlinked upon creation so data will not be |
| 141 |
readable by any other process. |
| 142 |
.PP |
| 143 |
.I xfs_fsr |
| 144 |
does not operate on files that are currently mapped in memory. |
| 145 |
A 'file busy' error can be seen for these files if the verbose |
| 146 |
flag (\f3-v\f1) is set. |
| 147 |
.PP |
| 148 |
Files marked as no\-defrag will be skipped. The |
| 149 |
.IR xfs_io (8) |
| 150 |
chattr command with the f attribute can be used to set or clear |
| 151 |
this flag. Files and directories created in a directory with the |
| 152 |
no\-defrag flag will inherit the attribute. |
| 153 |
.PP |
| 154 |
An entry in |
| 155 |
.I /etc/mtab |
| 156 |
or the file specified using the |
| 157 |
.B \-m |
| 158 |
option must have the |
| 159 |
.B rw |
| 160 |
option specified for read and write access. |
| 161 |
If this option is not present, then |
| 162 |
.I xfs_fsr |
| 163 |
skips the |
| 164 |
filesystem described by that line. |
| 165 |
See the |
| 166 |
.IR fstab (5) |
| 167 |
reference page for |
| 168 |
more details. |
| 169 |
.PP |
| 170 |
In general we do not foresee the need to run |
| 171 |
.I xfs_fsr |
| 172 |
on system partitions such as |
| 173 |
.IR / , |
| 174 |
.I /boot |
| 175 |
and |
| 176 |
.I /usr |
| 177 |
as in general these will not suffer from fragmentation. |
| 178 |
There are also issues with defragmenting files |
| 179 |
.IR lilo (8) |
| 180 |
uses to boot your system. It is recommended that these files |
| 181 |
should be flagged as no\-defrag with the |
| 182 |
.IR xfs_io (8) |
| 183 |
chattr command. Should these files be moved by |
| 184 |
.I xfs_fsr |
| 185 |
then you must rerun |
| 186 |
.I lilo |
| 187 |
before you reboot or you may have an unbootable system. |