Does disk defragmentation free up space?

Asked by Ashwat

No.

We’ll have to understand what disk defragmentation is in order to understand why it doesn’t free up space.

Let’s assume that your the free space and occupied space on your disk looks like the following

      <- occupied block ->         <-- free block -->
...---++++++++++++++++++++-----++++------------------+++++++---...
legend: - denotes free space on disk, + denotes occupied space

Now let’s say that we want to store a file on that disk. In order to not waste space on disk, we can’t leave the free blocks between the occupied blocks out of consideration.

Let’s consider the following strategy. We’ll scan the disk, check out the sizes of the first free block that’s available, and store a part of the file on that block. Then we’ll scan for the next free block and store another part of the same file on that block, and so on until we’ve stored the whole file. This strategy of storing the file on disk results in what is called “fragmentation” of the file.

All files that you create on/copy to your system are fragmented and stored in a similar manner. When you run the disk defragmentation utility, what it does is it scans the whole disk and tries “organize” the different fragments of different files and move the fragments so that they’re stored on contiguous memory locations.

So to answer the original question, since we’re just moving data from one place to another, there’s no freeing up of space. All defragmentation does is make the file reads from the storage drive sequential and hence faster.

Like what you read? Give Peeyush Kushwaha a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.