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 Disk Defragmenter in this article.
What is File Fragmentation in Windows?
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.
Files can become fragmented due to multiple reasons. One common cause is when the file system reserves excessive space for a file during its creation, resulting in gaps around it. Additionally, deleted files that have not been completely erased can also contribute to data fragmentation when new files are written.
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 initially added 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 the 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 installation 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.
Improvements in Windows Disk Defragmenter
File defragmentation is the process of reorganizing data on a storage medium, such as a hard disk drive, to optimize storage and retrieval. It helps improve computer performance by reducing file fragmentation. Defragmenting consolidates fragmented files, allowing for faster access and overall system efficiency.
The Windows Disk Defragmenter used too much memory and CPU resources till before Windows Vista. 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 11/10/8/7. The new Disk 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 is that the operating system looks for the 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 tool 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, but 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: