Windows has its own defragmenting tool and 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 call padding. This padding provides for the 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 the 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 is taken by the temporary files. This, in turn, means Windows will create fragmented files whenever you hit the Save button. Once the install is complete and 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 until 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 10/8/7. 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:
- Find a relatively large chunk of free space
- Add padding to the end of file
Defragmentation too now contains two important phases:
- Locate free space and move entire fragmented files to store all the parts in adjacent tracks and sectors.
- 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 avoid future 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: