# Hard Drive Fragmentation

How files get split into scattered fragments on a spinning hard drive, and how defragmenting puts them back in order so the head can read them in one sweep\.

By Numa

Topic: Computing, AI &amp; Electronics

[Open the interactive Jig](https://ask.jig.com/j/nQX2sipKV17E)

## Transcript

### 1. A spinning library

Inside a hard drive, a shiny disc called a platter spins up to 7,200 times a minute\. Everything you save lives on it as tiny magnetic patterns\. We draw them as little tiles and slow the spin right down so you can watch\.

This is a desktop drive with its cover off: about 147 by 102 millimetres\.

### 2. The reading arm

An arm swings the read/write head from ring to ring across the platter\. These rings are called tracks\. The head floats on a cushion of air and never touches the disc\.

The gap is only a few nanometres\. A human hair is about 70,000 nanometres wide\.

### 3. Files in a row

On a fresh drive, each file is saved as one neat run of tiles\. To read the orange file, the head moves once, then simply waits while the pieces stream past underneath it\.

### 4. Deleting leaves gaps

When you delete files, the drive does not scrub them away\. It just marks their space as free, leaving gaps of different sizes between the files you kept\.

### 5. A file in pieces

Now we save a big new file\. No single gap is big enough, so the drive splits it into pieces, called fragments, and tucks them into the gaps it finds\. The file is complete, just scattered\.

### 6. The head hops

To read the scattered file, the head must jump between tracks and wait for each piece to spin around to it\. Each wait is tiny, but a file in thousands of pieces adds up to a slow computer\.

A long jump across the disc takes about 10 thousandths of a second\.

### 7. Defragmenting

Defragmenting tidies up\. The drive reads the pieces and writes them back in order, so every file sits in one row and the free space joins into one big gap\.

### 8. One smooth read

Now the head moves once and reads the whole file in one smooth sweep\. Solid\-state drives have no spinning disc or moving head, so tidying does not help them\. Computers tidy spinning drives on their own\.

Defragmenting a solid\-state drive only adds wear, so computers leave them alone\.
