XFS Defrag

Story: Test: Do Linux filesystems need defragmentation?Total Replies: 2
Author Content

Dec 10, 2007
8:01 PM EDT
After reading some information about XFS a couple of years ago, I decided to use that filesystem. From what I understand, it creates eight virtual-partitions in each real partition it's installed on. The user never sees the eight partitions, but it's one of the things that really helps it. However, because the disk is split eight ways, it works best for larger disk drives - probably ones over 100GB being better than under 60. These days, it's pretty much every drive you can buy.

XFS allocates space on each of its partitions for new files and generally tries to keep them pretty well equally full (hence the preference for larger drives.) This tends to balance things out. However, unlike the other file systems, there IS a "defrag" utility for XFS. It's called "xfs_fsr", and can be run as you run other programs, although I'd probably stay away from complex downloads, 3-D image compilations, or other disk-intensive programs if possible - why work against yourself?

If you're using OpenSuSE, you'll want to install it as part of the "xfsdump" package. Once it's installed, you open a super user console window and type "xfs_fsr /dev/hda1" to start. In a few minutes, it's done and you've defrag'd the drive. No need to do a "init 3" or anything else.

Dec 10, 2007
8:05 PM EDT
Yikes!... The comment I made within the previous post with angle brackets seems to have disappeared. So I should say "replace '/dev/hda1' with the drive or partition that you wish to defrag." Sorry it didn't show in the original post.

Dec 10, 2007
8:38 PM EDT
Danger, Will Robinson, danger!

"xfs_fsr" cost me MANY files! I lost close to 50 ripped CD tracks alone, plus digital camera pics, documents, GNOME settings...

Files got mixed together, so that The Bangles' "Walk Like an Egyptian" suddenly turned into Simon and Garfunkel's "Cecilia," in the middle of the song. Beethoven's 9th symphony was unplayable.

(Yes, yes, backups. I know.)

AFAICT, xfs_fsr hasn't been updated in a while, and it is not included as a standard XFS utility with most Linux distros.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!