xfs_fsr
xfs.org
What it is
xfs_fsr is a free Linux utility in the xfsprogs project that reorganizes mounted XFS filesystems one file at a time. It copies a target file to temporary storage, then atomically exchanges the data extents of the original and temporary files. With no arguments, it chooses files with the largest extent counts and attempts the top 10% on each pass. A default run lasts up to two hours and records its stopping point for later resumption. You can name filesystems or individual files, with one pass through each target. Targets must be mounted read-write; entries without that option are skipped. Files mapped in memory and files marked no-defrag are not processed. Reorganization needs enough free space to copy the target, with space less fragmented than the original. On quota-enabled systems, the owner also needs sufficient remaining file quota. The manual says system partitions generally do not need this utility and warns that moving bootloader files can prevent booting unless lilo is rerun before reboot.
Spec sheet
- Purpose
- xfs_fsr reorganizes mounted XFS filesystems by improving the layout of file extents one file at a time.Read 4 Oct 2026 · man7.org
- Access requirement
- The filesystem must be mounted read-write; entries without the rw option are skipped.Read 4 Oct 2026 · man7.org
- Disk space requirement
- Reorganization requires enough free disk space to copy the target file, with space less fragmented than the original file.Read 4 Oct 2026 · man7.org
- How it works
- It copies a file to a temporary location and atomically interchanges the data extents of the original and temporary files.Read 4 Oct 2026 · man7.org
- Mapped files
- It does not operate on files that are currently mapped in memory.Read 4 Oct 2026 · man7.org
- No-defrag flag
- Files marked no-defrag are skipped, and the flag can be set or cleared with xfs_io's chattr command.Read 4 Oct 2026 · man7.org
- Operational caution
- The manual says system partitions generally do not need xfs_fsr and cautions that moving bootloader files can make a system unbootable unless lilo is rerun before reboot.Read 4 Oct 2026 · man7.org
- Project and support
- The manual identifies xfs_fsr as part of the xfsprogs project and directs bug reports to the linux-xfs mailing list.Read 4 Oct 2026 · man7.org
- Quota requirement
- On systems using quotas, the file owner must have enough remaining file space quota for the copy.Read 4 Oct 2026 · man7.org
- Selection
- With no arguments, it selects files with the largest numbers of extents and attempts to defragment the top 10% on each pass.Read 4 Oct 2026 · man7.org
- Targeting
- It can be run on named filesystems or individual files, making one pass through each specified target.Read 4 Oct 2026 · man7.org
- Time limit
- The default run lasts up to two hours and records where it stopped so it can resume later.Read 4 Oct 2026 · man7.org
Plans and prices
Strong points and limits
Strong points
- Free Linux utility
- Targets filesystems or individual files
- Resumes after two-hour default runs
- Selects highly fragmented files automatically
- Atomic extent exchange
Limits
- Applies only to XFS filesystems
- Requires read-write mounts
- Needs sufficient free space
- Skips mapped or no-defrag files
Who it suits
xfs_fsr suits Linux administrators managing mounted XFS filesystems who need file-level extent reorganization. It is relevant when targets, free space, mount mode, and quota conditions can be controlled.
Verdict
xfs_fsr provides targeted XFS extent reorganization with resumable runs and explicit selection rules. Administrators must account for storage, quotas, mount state, skipped files, and bootloader cautions.
Where Specifiction places it
- Disk Defragmentation Software#16 of 206.9