Skip to content. | Skip to navigation

Sections
Personal tools
You are here: Home Tutorials Defragment XFS File-system

Defragment XFS File-system

— filed under: ,

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
Please Donate

If you find contents of this website is useful to you, please consider to donate. Proceeds will go towards the site maintenance.

 
Creative Commons Plone Zope Python
web page monitoring website performance SiteUptime Web Site Monitoring Service Clicky Web Analytics