How does disk defrag work?

The word "disk defrag" is typically used to refer to the Microsoft Windows utility called Disk Defragmenter. It is designed to solve a problem that occurs because of the way hard disks store data.

If you have read the article How Hard Disks Work, then you know three key facts about hard disks:


  1. Hard disks store data in chunks called sectors. If you imagine the surface of the disk divided into rings (like the rings of a tree), and then imagine dividing each ring into pie-slices, a sector is one pie-slice on one ring. Each sector holds a fixed amount of data, like 512 bytes.
  2. The hard disk has a small arm that can move from ring to ring on the surface of the disk. To reach a particular sector, the hard disk moves the arm to the right ring and waits for the sector to spin into position.
  3. Hard disks are slow in computer terms. Compared to the speed of the processor and its memory, the time it takes for the arm to move and for a sector to spin into place is an eon.

Because of fact #3, you want to minimize arm movement as much as possible, and you want data stored in sequential segments on the disk.

So let's imagine that you install a new application onto an empty hard disk. Because the disk is empty, the computer can store the files of the application into sequential sectors on sequential rings. This is an efficient way to place data on a hard disk.

As you use a disk, however, this efficient technique becomes harder for a disk. What happens is that the disk fills up. Then you erase files to reclaim space. These files that you delete are scattered all over the surface of the disk. When you load a new application or a large file onto the disk, it ends up being stored in hundreds or thousands of these scattered pockets of space. Now when the computer tries to load the scattered pieces, the disk's arm has to move all over the surface and it takes forever.

The idea behind the disk defragmenter is to move all the files around so that every file is stored on sequential sectors on sequential rings of the disk. In addition, a good defragmenter may also try to optimize things even more, for example by placing all applications "close" to the operating system on the disk to minimize movement when an application loads. When done well on older disks, defragmenting can significantly increase the speed of file loading. On a new disk that has never filled up or had any significant number of file deletions, it will have almost no effect because everything is stored sequentially already.

As you might imagine, the process of indivdually picking up and moving thousands of files on a relatively slow hard disk is not a quick process -- it normally takes hours.

For the defragmenter to properly run, ensure you have no applications running. Typically, SYSTRAY and EXPLORER are all you need to have running to run this application. You can see the active tasks you have running by doing a "three-finger-salute" (Ctrl+Alt+Del). Disable any screen saver in use, too. The defragmenter will fail to stay running if your system is constantly accessing some other application like Findfast.exe, a resource user that automatically gets installed with Microsoft office. To prevent Findfast.exe from running at every system boot, simply delete it from your Windows STARTUP folder, or look for the Findfast icon in control panel and change its setting.

The defragmenter can take a considerable time to run, so start the Defragmenter before going out for the evening or at the end of the day, before going to sleep.

For more information, see the next page.


Frequently Answered Questions

What does disk defragmentation do?
Disk defragmentation organizes files on your computer so that they can be read and written more efficiently. When you defragment your disk, the system rearranges files so they are stored in contiguous blocks rather than scattered locations. This can improve performance because the system can quickly read and write files.
Is it good to do disk defragmentation?
Yes, it is good to do disk defragmentation because it can help improve the performance of your computer.