Real-world fragmentation

By Alastair on April 29, 2009

We often see claims on the Internet that fragmentation isn’t a problem on Mac OS X. We don’t believe that (and indeed, we use iDefrag here ourselves), but past experience suggests that our attempts to refute it are simply labelled as partisan and biased by the highly vocal anti-defragmentation camp.

Anyway, one of our customers today sent us a link to a screenshot showing 6,171 fragments in his swapfile, with the consequent effect on system performance that such a thing implies.

There’s no doubt that HFS+ is better than some other filesystems at avoiding fragmentation, but it certainly isn’t immune. Ironically even SSDs, where you would expect the uniform access time to render fragmentation a problem of the past, still have various problems caused by exactly the same issue1.

1 For avoidance of doubt, we strongly recommend that you don’t try to defragment your SSD-based volumes. The fragmentation issue on SSDs is internal to their implementation, and defragmenting the filesystem would only make matters worse.