DefragmentationDefragmentation (or defragging) is the process of physically reorganizing files on a computer hard drive so that filess are as contiguous as possible. This reorganization has nothing to do with the logical location of the files (that is, the location within the directory structure). Fragmentation occurs when the operating system cannot or will not allocate enough contiguous space to store a file and puts parts of it in gaps between other files (usually, those gaps exist because they used to hold a file that was deleted). A defragmentation program must move files around with the free space on the disk in order to undo fragmentation.
A heavily fragmented hard drive makes reading and writing data slower. Is is also often necessary to defragment in order to split a partition into two partitions without losing data (for example, with FIPS, Partition Magic, or ntfsresize).
Defragmentation can be impeded by the presense of immovable system files (or files that the defragmenter will not move in order to simplfy its task), especially a swap file.
Defragmentation programs often are included with an operating system (although Windows NT 4 notably did not include one) and usually it is recommended that they be run periodically to keep hard drive access as fast as possible.