As you use your computer, your files gradually become fragmented into smaller segments scattered across your disk. Some people consider this a serious problem and go to great lengths (and expense) to correct it. Before worrying about fragmentation, you should understand how and why it happensand what the real-world consequences are.
Pretend, for the sake of illustration, that your hard disk consists of exactly ten blocks, and that initially, your disk contains five small files (A, B, C, D, and E), each of which takes up exactly one block. Your disk looks tidy and clean, something like this: ABCDE_____.
If you delete files B and D and add a couple of new files, F and G, your disk looks like this: A_C_EFG___. If you then add a file H that's twice as big as the others, the drive puts it at the end, like so: A_C_EFGHH_. Now let's say file G grows to two blocks in size. There being too little space between F and H, G must split into two segments: A_C_EFGHHG. Finally, if you add file I and delete file F, your disk looks like this: AIC_E_GHHG.
Are you with me so far? Now imagine this happening with hundreds of thousands of files of many different sizes. Some tiny files might occupy just one block, while some huge ones may occupy millions of blocks. The more you read and write files, the more jumbled the data becomes: individual files split into numerous noncontiguous chunks, and lots of small, empty spots where other files once lived. That's fragmentation: the normal state of your hard disk!
Ordinarily, you never notice fragmentation, because Mac OS X keeps track of which parts of which files are where, and automatically reassembles or disassembles them as needed. With modern hard drives, this process is so fast that it's normally imperceptible. Furthermore, starting with Panther, Mac OS X included automatic background defragmentation of smaller (<20 MB) files, so that although files may not be contiguous with each other, at least most of them are in one piece.
The problem occurs when you have programs that must read or write massive amounts of information in real time, such as audio or video recording and editing applications. When these large files become fragmented, the drive's read-write head must physically zip back and forth over the disk to get all the segments, and sometimes the rate at which it does the zipping is too slow to keep up with the amount of data coming in (or going out). The results can include gaps in the data, stuttering, or slow application performance.
For ordinary users, defragmentation is a waste of time unless the fragmentation is extraordinarily severe (as evidenced by long delays in opening and saving files). But if you use high-end audio or video applications regularly, occasional (say, monthly) defragmentation is worthwhile. Several utilities pick up where Mac OS X leaves off, performing thorough defragmentation and making sure all the empty space on the disk is contiguous, in order to squeeze every last bit of performance out of your drive. The process is quite slow, howeverand if you're defragmenting large disks, your computer could be effectively out of commission for many hours. I recommend letting the process run overnight (or better yet, over a weekend). Defragmentation is also somewhat risky, since it involves deleting and rewriting almost every file on your drive. A good backup is always essential before undertaking defragmentation.
Related to defragmentation is optimization, which means moving the most frequently used files to the portions of the disk that can be accessed most quickly. Most utilities that defragment also optimize.
Utilities that perform defragmentation include:
Another way to defragment your disk is to make a complete, bootable copy (a clone) onto another hard disk, erase the original disk, and then reverse the process, cloning the backup disk onto the original. When the computer writes data to an empty drive, it automatically makes all the files contiguous.
Note that you cannot make a bootable clone simply by dragging files onto another drive. You must use a utility designed to do that job, such as SuperDuper! (www.shirt-pocket.com; $28), Carbon Copy Cloner (www.bombich.com/software/ccc.html; free, donations accepted), or most full-featured backup programs.