What's the command to defrag XFS?

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%

1 Answer

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

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like