Here is a excerpt I send to clients to explain, I can not take credit for this explanation, and can not remember where I got it from, at any rate, it explains it, and should also be noted that the defragging has nothing to do with the old desktop you somethimes see…
I first learned about defragmentation while talking to my father. He was a programmer back when “mass storage” meant a two foot reel of magnetic tape whirling away next to a room-sized mainframe computer. Today, we are spoiled by cheap 7200 rpm hard drives transfering data at 40 megs a second, with seek times under 9 ms. But back then, “seek time” actually meant something. If you wanted to retrieve a particular record from a database, it involved a gruelling wait as the tape turned around and around, finally reaching the right spot.
Later, when tapes began to store files under a system much like the one in use on today’s hard drives, fragmentation became a serious problem. So what is it? To answer that, you have to know a little bit about the way data is stored on a random access device (modern tape drives, hard drives, RAM, CDROM’s. . . just about any computer storage technology.)
First of all, files as we know them mean nothing to your hard drive. They’re just chunks of data that the operating system requests from time to time. For any file system to work, there has to be a way of quickly locating the file you want. Obviously you can’t just search through the entire drive, one byte at a time, until you find what you’re looking for. If you have an MP3 file that occupies 4 megs, your operating system needs to know exactly where that file is on your disk, so that when you go to play it, it can tell your hard disk to seek to the exact location where the data begins and spit out 4 megs of it.
The solution is a File Allocation Table (FAT). Your operating system uses the first part of your drive as a FAT, storing the names of all your files and their physical locations on the disk. If you want to access “stayinalive.mp3”, your operating system looks in the FAT and cross-references the file name to a specific location on disk. It tells your hard drive to seek to the proper location and retrieve the data.
Bingo, disco inferno!
But there’s a complication. To have a speed-efficient FAT, the data area of the drive must be divided into a finite number of identically-sized clusters (allocation units). Each cluster can hold only one file. Obviously, a single cluster (only 4 to 32k in size) will not accommodate a large file. In this case, the cluster holds the first portion of the file, and contains a pointer to the next cluster in the chain of clusters that collectively holds the entire file. Usually, the next cluster in the chain comes immediately after the preceding cluster. All well and good, but let’s look at a common scenario:
A file is written to disk; its chain is closed. A second file is written to disk. Logically, the operating system places this second file immediately after the first file on the physical disk. The second file is closed. But some time later, the first file needs to be changed – information must be added. What does the OS do? It cannot simply tack the extra data onto the end of the file, for that would overwrite the file beginning immediately after it. Instead, the OS begins adding to the file somewhere else on the disk. Then, it goes to the end of the original chain and adds a new pointer, indicating where the rest of the chain continues.
The problem with this method is that, although it is close to 100% efficient at conserving space, any files that are constantly modified will begin to occupy several chains across the disk. When these files are accessed, the drive must seek back and forth to read them in their entirety. Thus, when a file does not occupy a single, physically-continuous chain, we say it is fragmented.
Defragmentation works by examining the chain structure for every file on your drive, and then rebuilding fragmented files into single, continuous chains. For a large drive with many frequently-used files, this process is understandably slow.
Windows 98 and presumably all future Microsoft operating systems have Intel’s Application Launch Acceleration Technology incorporated into Disk Defragmenter. This feature takes advantage of the fact that Windows records the precise order in which any application loads its support files. When your disk is being defragmented, files are physically placed in the exact order they are loaded by common programs, reducing seek times later on, since the drive can now read data in a continuous stream.
This sounds marvellous, but the fact is that today’s drives seek very, very fast. Spending two hours to defragment a hard drive and move large chains back and forth will not save you two hours of lost performance. And defragmentation is certainly not the magical “cure all” many tech support personnel make it out to be. Still, it’s a useful chore when a computer is otherwise unoccupied.