Defragmenting in Apple OS X - Don't Do It ~ Ask The Admin

Saturday, October 20, 2007

Defragmenting in Apple OS X - Don't Do It

Defragmenting is just part of the Windows landscape. We've been doing it since...I dunno...Bill Gates hit puberty (Really?? he did?). Its just a habit, a way of life. Old habits die hard, even when users switch from a Windows OS to a new OS like Mac OS.

So, many users who have switched from PC's to Macs think that disk fragmentation is a concern in OS X, a problem that needs fixing. Truth is, except in very limited circumstances, its not a problem. In fact defragmenting an OS X disk can cause more harm than good. Fragmentation often creates a problem when small additions are saved onto files and overtime these little files end up spread all over the disk, slowing the machine down. However, innovations in software and hard drive technology (capacity, cache size, read speeds) allow many modern applications to rewrite the revised file in its entirety rather than saving all of the little attachments off in the recesses of the disk. Further, in recent OS X versions (10.2 and especially 10.3) Apple used delayed allocations of volumes (waiting for a batch of additions rather than writing each one as they come up) and automatic behind the scenes defragmenting of slow growing files for applications that do not rewrite the file each time it is re-saved. These changes negate the principal effects of defragmentation, and make the benfits of any defrag tiny.

Thats all great, but how can defragmenting actually hurt? Well straight from Apple's mouth: "there is also a chance that one of the files placed in the "hot band" for rapid reads during system startup might be moved during defragmentation, which would decrease performance." Basically, one of those many thousands of tiny files that are almost never used, may be moved to a place on the disk where the OS takes a bit longer to find, and while it looks, you wait.

However, I said there are very limited circumstances where you may see a performance gain from defragmenting and there are. Those situations have two common characteristics: 1) a nearly full hard drive 2) work with large files that are repeatedly revised such as RAW images and video. Working with these types of files on a near-full disk can cause problems if all of the little saved bits of commonly accessed data are spread across the disk, and thats where defragmenting can help. Otherwise defragging on the Mac is just not worth the effort. So kick the habit, and drop the urge to defrag that disk.

Resources:

Apple's official stance of defragging OS X.
The tool I recommend if you insist on defragging your Mac's disk - Disk Warrior X

One more thing: This should be the most obvious of all Mac tips, but before you do anything to your Mac disk - BACK UP. _JustiN_