Defragment your XFS partition

If one beautiful morning, you like me found yourself having performance problems with reading from your huge XFS partition, you probably will think about defragmentation for the partition (at last if you had former windows experience). And will be right, case XFS in difference of ReiserFS needs a defragmenation. So this is how you may do it.

Then you'll need to check if your partition needs a defragmentation in really

# xfs_db -r /dev/sda5
xfs_db> frag
actual 22222222, ideal 2342342, fragmentation factor 99.9%
xfs_db> quit

Once you see a scary fragmentation factor, run the command for the optimization

# xfs_fsr -v /dev/sda5

This whill take some time.

1 comment: