File system defragmentation is a not as obvious task in Linux/Unix as it is in Windows. Modern Unix file systems are designed to avoid fragmentation. However, in rare cases I explicitly want to defrag my favored XFS partitions, and it’s done this way:
Check fragmentation percentage:
CODE:
# xfs_db -r -c frag /dev/sda<i>X</i>
Defrag:
CODE:
# xfs_fsr /dev/sda<i>X</i>