What is file fragmentation and how does it occur in Windows

Windows has its own defragmenting tooland you might have used it already. When it comes to Windows file storing algorithms, the operating system makes a case for excess fragmentation through its temporary files. And probably that is the reason why it offers a defragmenting tool that we will refer to as Windows Defragmenter in this article.

What is File Fragmentation

How does Windows store files on the hard disk? Probably you know the answer. It tries to locate the first free sector equivalent to the file size – on the hard disk. It then stores the file there – along with some extra space we callpadding. This padding provides for expansion of files later. However, the calculation for padding is not accurate – given the fact that it is up to the user to decide how big the file can become later.

Suppose you created a Word document and typed in two words before hitting the Save button. Windows will locate a space just enough for those two words (with some padding) and save it. Later you keep on adding more words to the document. Windows tries to accommodate those additional words in the space it added initially to the saved document.

But then, Windows doesn’t know how many more words you would add to the document. Thus, once the additional space at the end of file is covered, it is time for Windows to look up free space beyond that padding and add the additional file to some other sector on the hard disk – probably on a different track or plate.

In addition, you might have noticed that while dealing with files (mostly when you install something or open an office file), Windows creates temporary files that are written to the hard disk the same way as the regular files. This means while you are working on a file, continuous free space on hard disk are taken by the temporary files. This in turn, means Windows will create fragmented files whenever you hit the Save button. Once the install is completeand the temporary files are deleted, you find your file spread across the hard disk, parts of which are stored across different sectors and plates.

In short, whenever you save, change, or delete files, Fragmentation occurs. The changes that you may make to a file are often stored at a different location. Additional changes are saved to even more locations. Over time, both the file and the hard disk itself become fragmented, and your computer could slow down a bit as it has to look in many different places to open one single file.

Having understood this, now let us see how Microsoft has improved the disk defragmenter to deal with this issue and to provide a better and easy disk defragmentation experience.

Windows Defragmenter – Improvements

The Windows Defragmenter used too much memory and CPU resources till Windows XP. It was well-known that, if you were running the Windows disk defragmenter in Windows XP or previous versions, you had to wait for it to finish before you could do anything else on that computer. Though a system software, the native disk defragmenter used too much memory and CPU – resource overheads that you would never want.

With the increase in size of hard disks and with the majority of people shifting away to use third party disk defragmenters, Microsoft came up with a better Windows Defragmenter in Windows Vista – and further improved it in Windows 7 | 8. The new Windows Defragmenter is totally overhauled, and you will find it to be unexpectedly fast. Also, it works in the background whenever your computer is idle and therefore does not jam your computer resources.

Another improvement that comes with Windows 7 or rather, Vista, is the operating system looks for largest contagious free space before storing a file you are working on. This means it tries to avoid fragmentation by two means:

  1. Find relatively large chunk of free space
  2. Add padding to the end of file

Defragmentation too now contains two important phases:

  1. Locate free space and move entire fragmented files to store all the parts in adjacent tracks and sectors.
  2. Bring free space together so that it becomes easier for Windows to store unfragmented files in the future.

This means when you run the Windows defragmenter, you are not only defragmenting the files, you are also optimizing your hard disk space to avoidfuture defragmentation to some extent.

I hope this helps you understand why defragmentation occurs in Windows and how you can use the Windows defragmenter to avoid defragmentation.

Additional readings on this topic:

  1. Troubleshooting Windows Disk Defragmenter utility
  2. How to defrag MFT, Page File, Registry, System Files in Windows.
Posted by on , in Category Windows with Tags
Arun Kumar is a Microsoft MVP alumnus, obsessed with technology, especially the Internet. He deals with the multimedia content needs of training and corporate houses. Follow him on Twitter @PowercutIN


  1. Bobby Phoenix

    Great write up. This is one of the best articles I’ve read in a while. I pretty much knew what you said already, but it’s nice to have it reinforced. Thank you.

  2. Nice article… now I know 😉

  3. Peter

    I used to use the built-in Windows Defragmenter tool, until I read this – http://downloads.condusiv.com/pdf/Windows_defrag_not_good_Enough.pdf

    I wanted one solution for home and business use. I know the built-in one is free, but I case you get what you pay for, right?


  4. Vasudev

    Nice article ! one more thing to add – Windows 7 automatically defragments your files so if needed then only do it manually.
    And with SSDs (flash drives) you dont have to worry about defragmentation.

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + 9 =