Friday, April 24, 2009

Defrag for Linux!!!

So I've heard that we don't have a defrag for linux because we don't need it. I understand that the ext filesystem leaves a litte bit of room at the end of files and does other bits of magic that keep fragmentation down. However, a 90% full volume is going to get fragmented. And there's no good way in linux to undo that, even if you unfill that volume. That's a bummmer. Also, windows power users switching to Linux aren't going to buy the whole "you don't need defrag" bit.

In comes John Dong's python based defrag utility. It uses the rather simple method of creating a copy of the file and then renaming the new file to the old filename. This allows the filesystem to put the entire file in the best possible location and then frees the old file. In theory it will work on any file system.

I have defraged my home directory and it made a noticable difference in performance. (I have had this same volume in continuous use for about 4 years. I have added this utility as a jaunty package to my PPA repository so everyone else can have linux defragmenter goodness without building the package themselves.

PPA:
https://edge.launchpad.net/~brywilharris/+archive/ppa

I plan to clean up the code a bit and then begin work on a GUI. (It's a work in progress so please don't sue me if this trashes your data! However, it worked for me.)

I will post some benchmarks once I've done a little more testing.

No comments:

Post a Comment