Defragment XFS File-system
Linux: How to defragment XFS
I have been using XFS file-system for all my Linux box for quite some time now. XFS have some fancy features such as live file-system defragmenting. Let's cover how to do that.
First, make sure you have the xfsdump utilities install. For Ubuntu or its derivatives distribution, simply issue this command:
sudo apt-get install xfsdump
Then, optionally you can check how fragmented your file-system is by this command:
sudo xfs_db -r /dev/hda1 xfs_db> frag actual 300086, ideal 299315, fragmentation factor 0.26% xfs_db> quit
In my case, my root is /dev/hda1. You need to reply with the device node containing your file-system you want to check.
How to defragment? Simple. Just invoke this command:
sudo xfs_fsr -v /dev/hda1 / start inode=0 ino=1278965 extents before:2 after:1 DONE ino=1278965 ino=2114947 extents before:2 after:1 DONE ino=2114947 ino=3912996 ... ino=254717564 extents before:2 after:1 DONE ino=254717564

Previous:
Adding bookmark button to Plone page





