Defragmentation – What it does and what it doesn’t


Posted on: August 26th, 2009

The purpose of this article is to shed some light and understanding to the process of defragmentation.

In order to understand what defragmentation is I’d need to explain a bit about how files are stored on a hard drive (or other media).

Hard drives themselves are divided into sectors, which are quite small. In order to make the space allocation manageable, bigger units called clusters (usually equal to 32 sectors) are used to keep track of what areas are occupied, and which ones are free. A big table is maintained at all times to show which file occupies which cluster(s).  In optimal case a file occupies adjacent clusters (eg: cluster 12, cluster 13….). In that case the hard drive’s read/write head will not have to jump around when reading the content of the file.

When a file that consists of more than one cluster, is not allocated in one continuous piece than it’s fragmented. It means that when the file is loaded in the hard drive needs to jump from one cluster to another and that’s a slower process than just going from one cluster to another.

The reason fragmentation happens most commonly is file deletions and then addition of files. When a file is deleted then the clusters it occupied gets marked as free. Some of the new files that are loaded on the hard drive is going to utilize that space and if the new file is bigger than the continuous free space then it will be stored in more than one piece.

For example if you are downloading let’s say music files from the internet. And then check them out and delete the ones you don’t like. Then download some more, delete some more, etc. This will create quite a bit of fragmentation on the hard drive.

Unfortunately, the file systems that Windows machines are capable of using are not designed to avoid fragmentation. So during normal usage, even if the hard drive is space is mostly free, the files on it will get fragmented. And if you are getting close to the capacity of the hard drive then the fragmentation gets really bad.

Fragmentation is the reason why a computer, even without installing any new software on it, gets gradually slower. Fortunately this process can be reversed with defragmentation. That’s the process of organizing the files on the hard drive so that they can be read in one piece without jumping around.

One interesting misconception regarding defragmentation is that it frees up space. It does not. At the end of a defragmentation you’ll have the exact same amount of free space as before. It only reorganizes the files it does not remove any of them, therefore it does not free up space.

How to do a defragmentation?

You can just run the defragmentation program that comes with Windows (can be found under Start -> All Programs -> Accessories -> System Tools). But I found out recently that it has some shortcomings. The first shortcoming is that it does not fill up all of the small empty spaces so new files loaded will get fragmented. The other one is that, at least in Vista, it does not defragment large files (larger than 64MB). It still does help to run it but because of these two shortcomings it’s effect is not long lasting.

There are some better ways to do defragmentation. First thing is that it’s very much recommended to clean up your hard drive before doing a defragmentation. It will reduce the time the process takes and you will get a better result. My favorite cleanup program is CCleaner (www.ccleaner.com).  It does a thorough job in cleaning up all kinds of temporary files, cookies, etc.

The second important thing to do is use a defragmenter that can do a thorough job, not a quick patch up. My recent search into this area found one that works quite well – it’s called MyDefrag. I usually use the “Optimize Monthly” option on it which does a thorough job. You can download that free from: http://filehippo.com/download_mydefrag/

And a very important thing to remember: It’s best to do the defragmentation when as few programs are running as possible. I’d recommend doing it in safe mode, if you can. But most definitely close all visible windows on your computer when doing the defrag.

How often should I do a defrag?

It really depends on how you use your computer. With a light usage and few new files saved and deleted you’d need to do a defrag maybe every month or so.

If you are a heavy downloader and/or save a lot of new files on your computer constantly. Then maybe it’s good to do it weekly.