« Back to Glossary Index

To defragment a disk drive is to physically rearrange the contents of the files stored on the disk so that they can be accessed more efficiently.

The information stored in a single file may not necessarily be stored  in one place. For a variety of reasons the data may be scattered in fragments kept in various locations around the surface of the disk. The file system keeps track of where all the fragments are so that when we use a file it behaves as one single thing.

Traditional hard disks involve actual moving parts, so a file that is scattered around a disk’s surface will be slower to access than one where all the pieces are near each other. Defragmenting simply rearranges the pieces of files such that they are not only near each other, but also in order, so that reading the file can take place as quickly as possible.

Disks without moving parts – such as flash drives and SSDs – typically do not benefit from defragmenting.

defragment (Wikipedia)
Visualization of fragmentation and then of defragmentation

In the maintenance of file systems, defragmentation is a process that reduces the degree of fragmentation. It does this by physically organizing the contents of the mass storage device used to store files into the smallest number of contiguous regions (fragments, extents). It also attempts to create larger regions of free space using compaction to impede the return of fragmentation. Some defragmentation utilities try to keep smaller files within a single directory together, as they are often accessed in sequence.

Defragmentation is advantageous and relevant to file systems on electromechanical disk drives (hard disk drives, floppy disk drives and optical disk media). The movement of the hard drive's read/write heads over different areas of the disk when accessing fragmented files is slower, compared to accessing the entire contents of a non-fragmented file sequentially without moving the read/write heads to seek other fragments.

« Back to Glossary Index