Don’t become a defrag junkie

Wed, 2007-07-18 12:05 by admin · Forum/category:

Disk fragmentation happens when files are deleted and other files written to a hard disk. The file system writes the new files into the gaps, but if some free space gap is not big enough, the remainder of the file has to be written into another gap elsewhere on the disk, possibly several times. The file is correctly written, the only problem is that, when reading it, the disk heads have to jump from one place to the next, which takes a little time. When files are fragmented into many small pieces, these delays can become noticeable. Also the hard disk is worn more.

Different file systems suffer from fragmentation to varying degrees. FAT and NTFS can fragment heavily, while more modern file systems like ext4 prevent fragmentation from the start, so they need no defragmentation at all or need it only rarely for a small extra bit of performance.

It is difficult to get really objective information on fragmentation. I also doubt that defragmenting is always advantageous, especially since installing and using the defragmenter costs time and money or, in the case of the built-in mini-defragmenter, at least some time.

However, there are cases in which some files fragment heavily and the system does slow down. An example could be a busy file server whose disk is fairly full.

I have tested several defragmenters on my own workstation and am absolutely sure that these can never recover my time I spent testing them.

I have not tested what happens when the defragmenter is running simultaneously with other tasks accessing the fragmented files.

Unfortunately you cannot even detect delays due to fragmentation. You can only guess. The fragmentation percentage figures are almost entirely meaningless, because they do not take into account whether it's a large file that's split into very few fragments (does not impede performance significantly), a small file split into very few fragments (probably even less important), or a file that you rarely need (again insignificant). The bigger performance hit happens only when you have

a) long files
b) that are split into many small fragments
c) physically far apart from each other (on distant disk cylinders)
d) frequently used
e) do not fit into the disk cache (depends on the amount of disk cache memory and therefore generally on the amount of memory—if you have a lot, fragmentation will not matter as much)
f) are read quickly with the computer waiting for the file data (if it's read slowly in small pieces while the computer does other things, again fragmentation does not matter much)
g) the computer does not have anything else to do on which to spend the disk wait time usefully
h) the user does not have anything else to do on which to spend the disk wait time usefully.

All of these points have to come together to turn fragmentation into a problem. If just one of the above is not present, the fragmentation does not matter.

Some other factors also have a bearing, for example hard disk command queuing. Newer disks and controllers offer NCQ (Native Command Queuing), which reduces the head movements of hard disks and therefore somewhat reduces the impact of fragmentation.

One test I can recommend is this:

  • Don't defragment your computer for some time, like a few weeks.
  • Reboot.
  • Load your favorite programs and stop the time they take. Of course you can measure more times, like the time needed for certain disk-bound operations you do often.
  • Defragment, using the built-in defragmenter.
  • Reboot. (Don't forget this.)
  • Repeat the measurement.

If you measure a considerable improvement, estimate how much time you save per day and never forget to subtract an estimate of how much time you'd waste while dealing with defragmentation, i.e. installing a defragmenting program, learning how to use it, setting it up, watching it work, checking the results, etc. Consider also that the defragmenter puts a high load on the computer, particularly on the hard disk, and will thus make it fail earlier than it would otherwise fail. This risk should be part of the consideration.

If, after critical assessment, you find that defragmenting will amortize itself in a reasonably short time, get the best defragmenter you can find and use it regularly. My recommendation has been PerfectDisk by Raxco from ca. 2000 to 2009.

Watch out for getting hooked to it and wasting more of your time on it. Don't become a defrag junkie. This could quickly turn your amortization estimate around and into the negative.

If you find that defragmenting will not amortize itself in a reasonably short time, do nothing and be happy.

Hint: has a free utility named PageDefrag that can defragment some system files like the swapfile that some other defragmenting programs cannot defragment. They also have a tool called Contig that can defragment selected files.

Not a defrag junkie, but defragging can be very useful

Mon, 2010-02-15 23:44 by Ben Myers

First a caution: PageDefrag does not run with Windows 7.

Next, anyone who sits around and watches a defrag run is wasting his/her time. Start up the defragger and go to lunch or do something else meaningful. A decent defragger will allow you to set it up to run and shut the system down when done.

Points a thru h in the original posting come together a lot more often than the original writer implies. Simply install and run Defraggler's analysis, and look at the typical high degree of fragmentation of frequently used files. I recommend Defraggler over Windows' built in defrag which tells you very little useful info and runs slower than Defraggler. Windows and NTFS have a habit of splattering file fragments all over the hard drive. Defraggler allows you to select which files to defragment, omitting 4GB Linux ISO files, for example.

Finally it is a waste of time to attempt to measure the performance improvement due to defragging. Too many random variables! ... Ben

I like the title of your

Thu, 2007-07-26 07:53 by ballast (not verified)

I like the title of your article "Don't become a defrag junkie" hehehe. An unhealthy obsession with defragmentation is clearly not a good idea :)

But, I am of the opinion that fragmentation slows down the PC noticeably if there is moderate to heavy fragmentation. The problem is compounded if your RAM is low, and the OS has to page the HDD frequently. Apart from the optical and hard drives, all other components are non mechanical in nature (excluding the fans lol) so these two will most often be the limiting factors in system speed. Can't do anything about the optical drives, but atleast keeping the HDD defragmented will help.

Now, I dont think that defragmenting will give some miraculous increase in performance out of nowhere, but it surely prevents degradation of HDD, and consequently overall system performance which would otherwise be a result of fragmentation. Gamers and other users who deal with large files will benefit from preservation of performance.

"If you measure a considerable improvement, estimate how much time you save per day and never forget to subtract an estimate of how much time you'd waste while dealing with defragmentation, i.e. installing a defragmenting program, learning how to use it, setting it up, watching it work, checking the results, etc."

Well, if you get something like the newer Diskeeper 2k7 versions, they do defragmentation quietly and automatically in the background. So don't need to spend much time with the software apart from the initial installation and configuration. A few minutes at most, then just leave it alone. When I installed Diskeeper on my system I enabled the automatic mode (it's on by default IIRC) and apart from a couple of minor configuration settings, that was it. Never had to touch it again.

slow and jerky

Fri, 2007-08-10 12:47 by goral (not verified)

I was far from obsessed with fragmentation, as a result, i dint give a darn abt it. Now the HDD is entirely fragmented, the system as slow as a snail and performing as if its inflicted with some neurodegenrative disease. Just purchased a new graphics card but i think it will be a while before i can troubleshoot this system and get it moving!

What's the cause?

Fri, 2007-08-10 13:46 by admin

The $1,000 question is, what's the cause? It could be fragmentation, but it could be something else as well. I've seen computers crippled by all kinds of things.

But you can find out about fragmentation easily—defragment the disk (overnight—it may take long) and check whether it's much faster afterwards.


I was a defrag junkie

Thu, 2007-07-26 09:58 by admin

Agreed. The article is a bit pointed. I wrote it as a counter-point just after I discovered that I had become a defrag junkie myself. (:-)

I admit that I still defragment my computers' hard disks from time to time, but these days I make sure I'm not wasting too much of my own time while doing that.


p.s. You wrote the very first comment on this newly redesigned web site. As reward you will get your own blog. Thanks!

Thank you

Sat, 2007-07-28 10:16 by ballast (not verified)

Thank you for your kind offer of a blog, but work keeps me too busy these days to be able to operate a blog. Your offer is however, very much appreciated :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.