l +1 262-553-6510

Automating Defragmentation Of Your Computer's Hard Drive

6/9/2010 - Author: Felicia

Computers, regardless of the operating system, utilize disk space using an inherently inefficient method. They utilize space on hard drives in a way in which files are placed in inefficient spaces and are often torn up and stored in parts. Let’s think about this in terms of a set of shelves in your home with books on it.

When you start with an empty bookshelf, you have room to put your books. As you buy more books, you may just place them on the shelves, or you may choose to organize them. For instance, you could change the orientation of the shelves in the bookshelf to make the gap between the shelves larger or smaller. You may need to accommodate larger books and smaller books. You may also want to organize the bookshelf so that the books are sorted by title, subject, or by frequency of use. Ultimately though, you must eventually organize the shelf in order to accommodate books when you are running out of space.

Computers act like people that just slap books on the bookshelf without organizing them at all. As the free space on the bookshelf gets used up, this storage is used inefficiently. Files that are frequently used are not necessarily stored at the beginning of the hard drive where they can be more quickly accessed. Imagine a situation where you had a thick book you needed to put on the bookshelf and you didn’t have any open space on the bookshelf that was large enough to accommodate it. You would reorganize the bookshelf to accommodate storing it. Computers don’t do that by themselves. A computer would take that thick book, rip it into small pieces and store it in the available empty spaces on the bookshelf. So every time the computer accessed that book, it would have to collect the randomly-stored pieces of the book, assemble the book, and then read the book. And when it was done reading it, it would have to rip the book up again and store it back into the available spots. When a computer does a lot of this, it’s called thrashing. This is because disk activity is so high that the computer slows significantly due to all this inefficient activity.

This is why defragmentation is necessary. People will tell you that there is a built-in defragmenter in Windows. I call it baby Diskeeper. Technically, Microsoft has been licensing Diskeeper Lite for years. I am not a fan of Raxco PerfectDisk. Diskeeper is a far superior product. If you think about the processes that your computer needs to run in an optimized way regarding defragmentation, Diskeeper does 100% of the functionality, but the built-in defragmenter only does about 20% of the functionality. Granted, 20% of something is better than nothing. So if you don’t want to spend the $40 for Diskeeper, then you can use the built-in defragmenter. I use Diskeeper on all my systems and I think it is mandatory for servers. If you use your computer over a 5 year time period, that $40 turns out to be $8 per year. That is cheap for what it does.

Diskeeper defragments system files, pagefile, files that are in use, the master file table, and folders. The built-in defragmenter can only defragment files that are not in use.

The defragmentation rule of thumb is that you have to have at least 20% freespace at all times on the hard drive in order to allow the computer to defragment itself. But as hard drives have gotten larger and larger, that number is more realistically 15%. Imagine having a 1.5 TB hard drive. 20% of that would be 300 GB. It would be crazy to say that you needed to have 300 GB free in order to defragment. Having 150 GB free in order to defragment would probably be sufficient.
A typical fragmented hard drive shown here.
This fragmentation analysis shows that files that are heavily accessed are not near the beginning of the drive. On the positive side, the pagefile (in yellow) is all in one chunk. If the pagefile is fragmented, that is bad news. You typicall see that with computers that were not originally purchased with enough RAM. That can be fixed, but you'd have to look up the registry key to clear pagefile at shutdown and then do a reboot and then undo that registry key change. I don't recommend you mess with the registry unless you are a computer expert and you do so at your own risk.
This image, where you see a lot of red, is very typical of a hard drive that is too darn full. How much whitespace do you even see in that picture? And, did you notice the blotches of yellow in various places. This machine is surely thrashing itself to death. Notice the green. These are system files. System files are accessed often, thus should be all together at the beginning of a drive, not strewn about. If you look at the large version of this image, you can see a small section near the end of the drive that looks like whitespace with diagonal lines through it. This is the master file table. This thing is accessed constantly. How efficient do you think it is for the MFT to be at the end of the drive? FragmentedDiskimage2
The next image is one of a full hard drive that has been defragmented by Diskeeper. It's a prime example of a drive that is too full, yet Diskeeper was actually able to defragment it. FragmentedDiskimage3
This disk is another example of a typical computer that has not been defragmented. You can see the large diagonal line area. That is the MFT. The pagefile is in one chunk. And the majority of the usage is towards the beginning of the drive. But you still see fragmentation. FragmentedDiskimage4
And finally, here is an example of an ugly situation. Here's a hard drive that has not been defragmented in a long time, if ever. There is definitely enough free space, but it just hasn't been defragmented. It's a sea of red. FragmentedDiskimage5

We have to help our computers defragment. If you don’t want to buy a full tool like Diskeeper, there is a way to automate or schedule the defragmentation of your computer’s hard drive. The process for accomplishing this is covered in the following video.