Fragmentation
Fragmentation is the dispersed storage of data, as opposed to contiguous storage. Learn how fragmentation happens on disks and in memory, how it differs from packet fragmentation, and why it matters for performance.
What is fragmentation?
Fragmentation happens when a piece of data, such as a file, is stored in many separate blocks scattered across a storage device instead of in one continuous area. The data is still complete, but the system has to collect the pieces from different locations each time it reads the file.
The same idea applies to memory: free space can become split into many small gaps that are too small to use efficiently.
How does fragmentation happen?
File systems store data in blocks. Over time, files are created, deleted, and resized:
- Deleting files leaves gaps of free space of different sizes.
- New or growing files are written into whatever gaps are available.
- A large file may not fit in one gap, so it is split across several.
On traditional hard disk drives (HDDs), reading a fragmented file means moving the read head between locations, which slows access. Defragmentation rearranges the blocks so each file is stored contiguously again.
Disk fragmentation vs. packet fragmentation
Disk fragmentation is about how stored data is laid out. In networking, fragmentation means splitting a packet that is too large for a network link into smaller fragments, which are reassembled at the destination. The two share a name but solve different problems.
Why does fragmentation matter?
On hard drives, heavy fragmentation slows file access and system performance. Solid-state drives (SSDs) are much less affected, and they are managed differently: operating systems use the TRIM command rather than traditional defragmentation, which would cause unnecessary wear. Modern operating systems handle most of this automatically on a schedule.
Fragmentation also matters in databases and virtual machine disk files, where data that is spread out can slow queries and backups. Database maintenance tasks, such as rebuilding indexes, address this.
Frequently asked questions
What is fragmentation?
Fragmentation is the dispersed storage of data, as opposed to contiguous storage, so that a file is split across many separate locations on a disk.
Should you defragment an SSD?
Generally, no. SSDs read scattered data quickly, and traditional defragmentation adds wear. Operating systems optimize SSDs with TRIM instead.
Does fragmentation cause data loss?
Not by itself. Fragmented files are complete; they are just slower to read on hard drives. Data loss comes from other problems, such as disk failure or corruption.
Simplify routine IT operations
Manage a wide range of remote connections and tools from one centralized platform.
Related terms
Packet
A packet is a section of data that has been divided into several pieces for easier transfer and is later reassembled with its counterparts to form a whole.
Read now →Server
A server is a computer or system that listens for client requests and responds with a service.
Read now →