What is Defrag? Why does it take so long?

When time permits, I like to answer questions which come in via twitter with a little more than the space required to ask them.  Especially, if the answer may be useful to others. The question asked,

"is there was a faster way to defragment my hard drive?"

and attached the following image:

Defragmentation question. 

Defragmentation question. 

While Hiren's Boot CD is an excellent recovery tool, it does not make use of your system's full horsepower.  When low-level emergency data recovery is necessary, booting a system as simply as possible is important. Defragmentation differs from most of the other tools in Hiren's tool kit because it is a far more complex and demanding procedure.  

Think of defragmentation as similar to the way potato chips are, according to every bag, "packaged by weight, not by volume."  Why the bizarre metaphor? Read on! 

When a windows disk is formatted, the parts of the disk are separated in to (pardon the pun) byte sized pieces called clusters.  NTFS allows for the size of those clusters to be defined at the time of the disk's formatting. The size of the cluster matters, mostly because it is the smallest recognizable size the disk is allowed to write when it begins to erase, write, and re-write data to the disk.

Over time, these clusters begin to develop gaps.  Some of the gaps are big enough to be filled in automatically as the drive needs more space, others, remain unused.  In the real world, some files are erased frequently while others are barely touched once they land on a drive.

Photo: Wikipedia

Photo: Wikipedia

I mention cluster size because, like most things in science, it is rather important to select the proper unit of measure when beginning calculations.  We'd never measure our height in millimeters or our weight in tons because the units are unsuitable for the task at hand.  Similarly, while the default NTFS cluster size is 4096bytes (or, 4 KBytes), drives under 500 Gigabytes which are used heavily on tasks such as downloading via bit torrent will be less fragmented if you select a smaller cluster size.

Back to potato chips! Ideally, every disk would resemble a stack of Pringles with each piece of new data perfectly stacking next to its counterparts.  In reality, our data usually looks more like this:

 

Photo Credit: Tumblr.com

Photo Credit: Tumblr.com

Hence, the fragmentation in 'de-fragmentation'.  To fix this, your computer needs to have a much more big-picture sense of the data it is going to be clustering together.

In short, you're much better off running defrag with a higher level disk utility like Piriform's Defraggler which, while part of Hiren's more recent builds, seems to work better under a fully driver enabled environment.  More importantly, if you're going to be downloading files using peer to peer networks, use a second hard drive if at all possible.  When the download completes, move the file to its final resting point on your main data drive.  That will give you a far less fragmented disk to begin with.  Combine the less fragmented drive, with system booted in to a full instance of Windows, and you'll never spend hours waiting for defragmentation.  Also, Windows 7 & 8 will defragment automatically if you let them.

I hope that helps!   

Got a question for Nerds LTD? 

© Apple, Inc. 

© Apple, Inc. 

Call or text 24/7:   

(505) 750-8885  

iMessage your Mac, iPhone or iPad  

Facebook & Google+ works if you'd prefer. As well as good old fashioned email

 

PS. Defragmenting your drive is for mechanical hard drives onlySolid State Drives have their own means of maintenance and should almost never require defragmentation.  Running defrag on your Solid State Drive will not speed it up and will almost certainly shorten its life!