File fragmentation can be a real plague on traditional hard drives. They slow down your entire computer, while reducing the life expectancy of the drive. But how does this come to be? Why is it that files somehow end up scattered across the whole drive?

It’s actually quite simple. Imagine the hard drive as being a series of boxes, each one capable of holding 1 byte of information (in reality, it would be more accurate to think of these boxes as holding 1 bit of information, but for the sake of simplicity, we’ll just think of them as storing 1 byte):

Empty memory

When the hard drive is new, all of these boxes are empty.Now, let’s say we store a 3 byte file on the drive. This file will fill up three boxes.

3 Bytes taken

Now, we add a new 14 byte file to our drive, the computer appends this data to the previous file. At this point, we still have no file fragmentation.

2 Files written

Now, let’s say we delete the first file. This leaves us with some free boxes before and after File 2.

Delete fie 1

As you can see, we now have 6 bytes of free space on our hard drive. But, does that mean we can add a new 5 byte file? Indeed, we can, but we now encounter a problem, which is that we only have 3 byte of contiguous free space. This means that the computer will need to split this new file into 2 parts:

File 3 split in 2

So now, to read File 3, the hard drive head (the “needle” that reads and writes data to the drive) must jump over several blocks of memory. This makes the operation slower and more damaging to the hard drive.

That summarizes, extremely roughly, why do files get fragmented.

-Icosebyte

Leave a reply

required