8

I have a /home partition in a separate disk with XFS, how do I de-fragment it ? (on-line or off-line)

I haven't tried anything yet and the / partition has BTRFS. Also how to schedule it would be nice. But I can check that out in already responded questions.

This was the output :

sudo xfs_db -c frag -r /dev/sdb5
actual 329394, ideal 301436, fragmentation factor 8.49%
userDepth
  • 2,040

1 Answers1

13

XFS provides a filesystem defragmentation utility, xfs_fsr that can defragment the files on a mounted and active XFS filesystem.

It can be useful to view XFS fragmentation periodically.

xfs_fsr improves the organization of mounted filesystems. The reorganization algorithm operates on one file at a time, compacting or otherwise improving the layout of the file extents. Inspect fragmentation levels

To see how much fragmentation your file system currently has:

sudo xfs_db -c frag -r /dev/sd??

To begin defragmentation, use the xfs_fsr command which is included with the xfsprogs package.

sudo xfs_fsr /dev/sd??

Change ?? to what corresponds your partition

kyodake
  • 17,808