Nothing Undone

A weblog, by Peter Jaros.

How My Mac Became Horribly Fragmented, and How I Fixed It.

A tale of caution:

Sometime last year, long after most everyone else, I finally upgraded my Mac to Lion. And yes, I had to get used to the scrolling, and the buttons looking different, and fullscreen working differently, but I got used to all of that. There’s one thing I didn’t get used to, though.

My Mac got really, really slow.

Usually I noticed it when I switched applications, but I also noticed it any time I used the disk a lot or swapped out a lot of memory. I was worried my disk was dying.

I asked folks on Superuser.com, once about why my computer was sluggish, and once about why my menu bar blacked out the application name when I switched applications and looked like this:

Menu bar with oddly blacked out application name

The answer was less dire than I’d feared: my hard drive was highly fragmented. But that’s not possible! Macs don’t get fragmented, they have some magic algorithm which defragments files invisibly as their used. In fact the only way to get a Mac in such a horribly fragmented state…

…would be to update large swaths of data all at once. Say, by installing a new operating system.

What to do?

I diagnosed the problem using iDefrag, which has a demo which will scan your system. Ultimately, I opted not to use it to fix the problem though.

I wanted a bootable clone backup before I did something like that (which I didn’t have yet), and I felt it was a good time to replace my hard drive just in case. So I bought a new identical drive, stuck it in an enclosure, Carbon Copy Clonered it, then did some minor surgery and swapped the two drives. CCC by default copies files using rsync or something like it, rather than copy the raw data, which means that the same files ended up on the new drive defragmented.

The difference has been huge. My machine is usable again.

The moral

Probably the right lesson to take from this is: always do a clean install. Keep a bootable backup, wipe your drive, clean install, and move things back from your backup.

The alternative is to defrag after an upgrade, but that doesn’t sound very fun.

Of course, neither does moving all my stuff back from that backup drive, which is why I’ll shortly be automating that with Brewstrap. More on that as it develops. But until I get there, I’m probably not going to upgrade to Mountain Lion.


Update: Patrick Tulskie says,

Comments