Defragment vs. Format
Defragmentation (also known as defrag or disk defragmentation) is a process by which the system reduces the amount of fragmentation in file systems. It does this by physically putting the contents of the disk in sequential order for the purpose of storing the pieces of each file in the system close together, and contiguously (that is, touching in sequence). The main objective is to provide more space in the disk through the process of compaction, so to eradicate further occurrences of fragmentation.
Formatting is a command used to accomplish many tasks: Place the boot record in a location specified by the partition table; clear FAT entries by changing them to 0x00; clear the root directory by changing any values found therein to 0x00; format and check each cluster to find out whether that cluster is good or bad,and mark it as such in the FAT. Formatting is usually necessary in order to change a disk file system.
Fragmentation occurs when the system is unable to allocate enough space for the memory stored on the disk – that is, there is not enough space on the disk to save an entire file, and it puts the file in gaps between other files saved on the disk. Defragmentation fixes this problem by moving files around within the free space that has been created by moving the files closer together. It is a memory intensive operation, and is incapable of being performed on a file system that has no physical free space. Though reorganisation does create a bit more space, it does not change the logistics of the files because their location has been defined within the directory structure.
Formatting cannot do anything with the data area itself. The data area remains untouched when the disk is being formatted. Any data that has been previously written to specific media is still intact until it is overwritten when a particular cluster is reassigned to new data. In earlier versions of MS-DOS, the default location in which formatting occurred was in an inserted floppy disk, but the designers of DOS found it more convenient to change the default location to the drive that was most used -therefore, the newer versions of DOS formatted the C Drive automatically, causing lay users cataclysmic problems when their work was lost while the disk was being formatted.
Summary:
1. Defragmentation is an operation that attempts to create more space on the main disk by putting files of the same family adjacent to each other, sequentially; formatting is a command used mostly to change a disk file system.
2. Defragmentation fixes aggregate fragmentation by moving files around within the free space created when the files on the disk have been moved closer together; formatting does nothing to the data area itself, but when clusters of data are created, that data is replaced with that particular cluster.