Defragmentation

Visualization of fragmentation and then of defragmentation
Examples of five states of fragmentation
A Windows defragmentation utility

Process that reduces the degree of fragmentation.

- Defragmentation

58 related topics

Relevance

File system fragmentation

Tendency of a file system to lay out the contents of files non-continuously to allow in-place modification of their contents.

Visualization of fragmentation and then of defragmentation
Simplified example of how free space fragmentation and file fragmentation occur

Fragmentation can be remedied by re-organizing files and free space back into contiguous areas, a process called defragmentation.

File system

Method and data structure that the operating system uses to control how data is stored and retrieved.

An example of slack space, demonstrated with 4,096-byte NTFS clusters: 100,000 files, each five bytes per file, which equal to 500,000 bytes of actual data but require 409,600,000 bytes of disk space to store
File systems may become fragmented
Directory listing in a Windows command shell

An example is the file system defragmentation utilities.

Fragmentation (computing)

Phenomenon in which storage space, main storage or secondary storage, is used inefficiently, reducing capacity or performance and often both.

1 GiB of SDRAM mounted in a computer. An example of primary storage.

For example, the primary job of a defragmentation tool is to rearrange blocks on disk so that the blocks of each file are contiguous.

Memory paging

Memory management scheme by which a computer stores and retrieves data from secondary storage for use in main memory.

A human computer, with microscope and calculator, 1952

Defragmenting the page file is also occasionally recommended to improve performance when a Windows system is chronically using much more memory than its total physical memory.

Windows NT 4.0

Major release of the Windows NT operating system developed by Microsoft and oriented towards businesses.

A screenshot of Windows NT Workstation 4.0 SP6, showing the Start menu and Windows Explorer
A screenshot of Windows NT Workstation 4.0 SP6, showing the Start menu and Windows Explorer

File system defragmentation support

NTFS

Proprietary journaling file system developed by Microsoft.

Fig. 1: NTFS file system permissions on a modern Windows system
A sparse file: Empty bytes don't need to be saved, thus they can be represented by metadata.

It is a feature that FAT does not provide and critical for NTFS to ensure that its complex internal data structures will remain consistent in case of system crashes or data moves performed by the defragmentation API, and allow easy rollback of uncommitted changes to these critical data structures when the volume is remounted.

Hard disk drive

Electro-mechanical data storage device that stores and retrieves digital data using magnetic storage and one or more rigid rapidly rotating platters coated with magnetic material.

Partially disassembled IBM 350 (RAMAC)
Internals of a 2.5-inch laptop hard disk drive
A disassembled and labeled 1997 HDD lying atop a mirror
Magnetic cross section & frequency modulation encoded binary data
Destroyed hard disk, glass platter visible
Diagram labeling the major components of a computer HDD
Recording of single magnetisations of bits on a 200 MB HDD-platter (recording made visible using CMOS-MagView).
Longitudinal recording (standard) & perpendicular recording diagram
An HDD with disks and motor hub removed, exposing copper-colored stator coils surrounding a bearing in the center of the spindle motor. The orange stripe along the side of the arm is a thin printed-circuit cable, the spindle bearing is in the center and the actuator is in the upper left.
Head stack with an actuator coil on the left and read/write heads on the right
Close-up of a single read-write head, showing the side facing the platter
Leading-edge hard disk drive areal densities from 1956 through 2009 compared to Moore's law. By 2016, progress had slowed significantly below the extrapolated density trend.
Two Seagate Barracuda drives, from 2003 and 2009 - respectively 160GB and 1TB. Seagate offers capacities up to 20TB.
8-, 5.25-, 3.5-, 2.5-, 1.8- and 1-inch HDDs, together with a ruler to show the size of platters and read-write heads
A newer 2.5-inch (63.5 mm) 6,495 MB HDD compared to an older 5.25-inch full-height 110 MB HDD
Inner view of a 1998 Seagate HDD that used the Parallel ATA interface
2.5-inch SATA drive on top of 3.5-inch SATA drive, showing close-up of (7-pin) data and (15-pin) power connectors
Close-up of an HDD head resting on a disk platter; its mirror reflection is visible on the platter surface. Unless the head is on a landing zone, the heads touching the platters while in operation can be catastrophic.
Two 2.5" external USB hard drives
Diagram of HDD manufacturer consolidation

Defragmentation is a procedure used to minimize delay in retrieving data by moving related items to physically proximate areas on the disk.

Btrfs

Computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (not to be confused with Linux's LVM), developed together.

Screenshot of usage information of a Btrfs filesystem
Example of snapshots of a Btrfs filesystem, managed with snapper
Example of Btrfs quota groups

In July 2011, Btrfs automatic defragmentation and scrubbing features were merged into version 3.0 of the Linux kernel mainline.

Microsoft Drive Optimizer

Microsoft Drive Optimizer in Windows 10
Microsoft Drive Optimizer in Windows 10

Microsoft Drive Optimizer (formerly Disk Defragmenter) is a utility in Microsoft Windows designed to increase data access speed by rearranging files stored on a disk to occupy contiguous storage locations, a technique called defragmentation.

Solid-state drive

Solid-state storage device that uses integrated circuit assemblies to store data persistently, typically using flash memory, and functioning as secondary storage in the hierarchy of computer storage.

250 GB mSATA SSD with an external enclosure
512 GB Samsung M.2 NVMe SSD
An Intel mSATA SSD
An M.2 (2242) solid-state-drive (SSD) connected into USB 3.0 adapter and connected to computer.
An SSD with 1.2 TB of MLC NAND, using PCI Express as the host interface
An SSD with a 2.5-inch HDD form factor, opened to show solid-state electronics. Empty spaces next to the NAND chips are for additional NAND chips, allowing the same circuit board design to be used on several drive models with different capacities; other drives may instead use a circuit board whose size increases along with drive capacity, leaving the rest of the drive empty
A 2 GB disk-on-a-module with PATA interface
SSD benchmark, showing about 230 MB/s reading speed (blue), 210 MB/s writing speed (red) and about 0.1 ms seek time (green), all independent from the accessed disk location.
CompactFlash card used as an SSD
An SSD that uses NVM Express as the logical device interface, in the form of a PCI Express 3.0 ×4 expansion card
Viking Technology SATA Cube and AMP SATA Bridge multi-layer SSDs
Viking Technology SATADIMM based SSD
MO-297 SATA drive-on-a-module (DOM) SSD form factor
A custom-connector SATA SSD

Defragmentation should be disabled on solid-state drives because the location of the file components on an SSD doesn't significantly impact its performance, but moving the files to make them contiguous using the Windows Defrag routine will cause unnecessary write wear on the limited number of P/E cycles on the SSD.