Thursday, January 31, 2008

Tips on defragmenting your hard disk

What is defragmentation?

Defragmentation is a process that reduces the amount of fragmentation in file systems. Fragmentation occurs when the operating system cannot allocate enough contiguous space to store a complete file as a unit, but instead puts parts of it in gaps between other files. Frequent installation and un-installation, creation and deletion etc of files are the main causes of file fragmentation. The defragmentation process reorganizes the contents of the disk to store the pieces of each file close together and contiguously. It also attempts to create larger regions of free space to prevent further fragmentation.

How to defragment the hard drive?

Windows XP (and Vista) has a defragmenting utility which can be accessed through Start>All Programs>Accessories>System Tools>Disk Defragmenter. Though the default Windows defragmenting program is enough for most people there some better utilities out there that does the job better. The most recommended being the O&O Defrag. However O&O Defrag comes at a price, so you might want to have some free alternatives. In that case Defraggler and WinContig should work fine for you. Use whatever tool you want but just remember the following points.

1. Before you start defragmenting perform a thorough clean up of your hard disk. The presence of temporary and unwanted files will prevent the proper defragmentation of your more important and "permanent" files. Use a junk file cleaning tool like CCleaner or WinXP Manager to clean all junk files that were accumulated on your hard disk.

2. Clear your browsers cache; if you are using multiple browsers clean each one's cache individually. Clear the browsing history as well.

3. Empty the Recycle Bin. Before you do that check whether there are any files in it that you might want to restore. I suggest you to read 9 places where you could lose hard disk space and how to regain it to know where to look for such temporary and unnecessary files.

4. Before defragmenting it's recommended that you disable Windows pagefile. This file is locked in place on the hard disk and cannot be defragmented by regular disk defragmentation programs, even Windows inbuilt tool. Worse, often the page file is severely fragmented making it difficult for the defragmenter to properly defragment other files on the hard disk. Removing the pagefile will free up disk space and make defragmentation more efficient. To remove the page file go to Control Panel> System>Advanced. Under the Performance tab click on Settings. Then again click on Advanced tab and then click Change under the Virtual Memory section. Now select "No paging file" and click Set.

5. Similarly, defragmentation is more effective if you remove the hiberfil.sys file from the hard disk. The hiberfil.sys is the file that is created when the Hibernate feature is enabled on your computer. It's size is exactly equal to the size of your main memory (RAM) and is used to store it's content when you hibernate your computer. Like pagefile, the hiberfil.sys files is usually fragmented too. To remove the hiberfil.sys file, go to Control Panel>Power Options>Hibernate and then uncheck "Enable Hibernation".

6. The defragmentation process can take long amounts of time to complete depending upon the size of the hard disk and how badly fragmented the files are. During this time the hard disk is continuously at work and that can produce large amount of heat. Heat is the biggest enemy of your hard disk. Before you begin the process make sure you have a hard disk cooler in place or a simple chassis fan blowing over the hard disk, particularly if you live in a warmer climate. The hard disk temperature should remain below 40 degree Celsius as far as possible.

7. After you have finished defragmenting your disk, enable the pagefile again and hibernation, if you use that feature by reversing the steps you performed in Step 4 and Step 5. If you want you can also defragment the pagefile and the hiberfil.sys file by using a tool called PageDefrag. PageDefrag also defragments a bunch of other files not normally defragmented by other tools.

Defragmenting your hard disk hardly brings any noticeable difference on the speed of your computer, in most cases. Most people say that regular defragmenting will prevent disk thrashing, because the hard disk head won't have to read from multiple places just to open one file. In reality, defragmenting will do little to prevent disk thrashing. The hard disk keeps thrashing all the time, when it reads and writes from the page file and that happens almost all the time. Also remember that when the defragmenting process is on, you are essentially thrashing your hard disk for long periods of time. Even so, it's essential to keep your hard disk defragmented, but don't over do it. Some people have an obsession for defragmenting and does it every week. Don't do that. Once a month or even once every 3 months is enough to keep your hard disk running nice and fast.


  1. Defragmenting is a maintenance task that help keeps the drives organized and fast. Once they run out of free space and get severely fragmented, its more difficult to handle. Keeping the drives defragged, not only help in speed but also postpone if not prevent drive disasters which may warrant premature drive replacements, tech help etc.

  2. Somebody has copied your post without giving any credits to you.

  3. Actually, some people do a defrag every day. Now that is an obsession. The problems caused by a fragmented drive have been greatly exagerated, due in no small part to the advertising of some commercial defrag utlities. The fact of the matter is, fragmentation effects performance very little except in extreme cases. Yes, defrag your drive regularly, but generally no more than once a month.

    Larry Miller
    Microsoft MCSA


Popular Posts