Macs and Fragmentation

Because of how disk storage works, fragmentation happens. This in inevitable.

Files get written and re-written, added to and moved. They end up in pieces, and new files end up getting broken up as they are written to the free spots between the pieces of the older files.

On a mechanical hard drive, having fragmented files slows things down. Instead of just simply loading your files, your hard drive has to search all over the physical drive surface for the pieces of the file. It doesn't take too long for the drive to do that with a single file, but your system is usually trying to access dozens or hundreds of files at the same time. So having split-second delays over and over added for every single file access can cause noticeably longer system startup and program launching.

Having one, contiguous block for each file helps the hard drive load the file quicker. Seems like a simple concept. That's why there are defragging applications. These re-arrange files to put things back together.

Well, that's how it works in Windows at least. MyDefrag (was JkDefrag), Defraggler, Auslogic's Defrag, Contig, and Power Defragmenter (a GUI for Contig) are all free defragmentation tools, for Windows.

But what about for Macs?

Macs use the same hardware Windows PC use. The same hard drives. The same technology. And they suffer the same performance degradation caused by hard drive fragmentation.

I've seen many Mac users claim that Macs don't suffer from fragmentation. True, Mac OS X may work with files better than Windows XP does, but fragmentation still happens.

I used a MacBook Pro for work. Core 2 Duo @ 2.16 GHz, 4 Gigs RAM. Its hard drive was a Fujitsu 120 Gig, 5400 RPM w/ 8 Megs Cache.

Performance on it seemed poorer than I expected it to be. Startup seemed to take forever. Application launching seemed to take forever. If this were a Windows system, I'd would have done three things on it right away:

1) Check for unnecessary startup items.
2) Run ChkDsk.
3) Defrag.

Since it's a Mac, things are a little different.
1) I checked for startup items. Nothing visible under User Accounts.
2) I ran fsck and ran a permissions repair. No issues there.
3) ...? Uh, no built-in defrag app.

I Google'd Mac defragmenting. I couldn't find a lot of good information.

Some information found:

- Macs "don't need to be defragmented" was one thing mentioned over and over and OVER.
- Apple's own website recommended backing up your applications and files, formatting, re-installing the OS, and then restoring your applications and files if you wanted to restore performance. (And this is easier than just running a defrag?)
- Strange information about Mac OS X actually auto-defragging files under 20MB. But no information on when it happens, how to do it manually, etc.
- Some stupidity about how hard drives in general are so big and so fast, they don't need to be defragged. (Yeah, right. Just like that 340 Meg hard drive I got in 1994 would never fill up!)

I ran iDefrag on my MacBook Pro. Here is what the program showed me:

Mac Fragmentation - 1

Keep in mind that *RED* means fragmented files.
I thought Mac OS X was supposed to auto-defrag things?

Well, looks like plenty of fragmented files to me. Tons of "under 20 MB" files were in lots of pieces. Some of the bigger files are in 600+ fragments. Does the "Macs don't need to be defragged" crowd really think it makes NO impact in performance for my computer to try and load that file each day? Would I really get ZERO benefit from having those files in just ONE piece? Wouldn't the OS load up a bit quicker if system files were in contiguous blocks? Wouldn't Firefox load just a tad quicker if its files weren't in hundreds or thousands of locations all over the hard drive?

I ran a full defrag on the hard drive.
Here is what it looked like after a defrag:

Mac Fragmentation - 4


I wanted to run some tests to see how much defragging my Mac would speed things up. The best test I could think of would be something real-world. Every day I turn on my Mac and wait for things to load so I can check email or websites, so I would test how long it takes to do that.

I removed my password, set Mac OS X to auto login, and then I set Firefox to auto start. No other applications were listed in under my account to auto start. My Firefox start page is the default Google one.

I timed how long it took to load, from the second I pushed the Power button, until the second everything was loaded and Firefox said "Done." in the bottom-left of the browser. Simple enough I figured.

First, I timed my average boot before the defrag: 1 minute, 48 seconds. Ouch.

Then, I ran a full system defrag. This took several hours. After it finished, I ran some more boot tests. I shut down completely, then powered back on. I timed how long that took. I shut down again and and powered back on a few more times, always timing how long it took for the system to power on, fully load, and load Firefox.

Average boot time AFTER a defrag: 1 minute, 5 seconds. Much better.

So... Uh, yeah. I'm not sure why so many people claim you don't need to defrag a Mac, but obviously the system sure seems to be booting a lot faster. The system boots faster, applications load a bit faster, etc.

The defrag did take several hours. I'm guessing maybe around 5 or so. I'm not positive, as I just started it and left to go do something else.
Perhaps it would have been faster to just move my programs and files off of the system, format it, then re-install everything. This is the Apple recommended method of "optimizing" the hard drive.
Of course, the defrag probably took so long since the drive has NEVER been defragged before. If there was a built-in defrag tool, maybe I could have ran it on a regular schedule for a few minutes.


This page talks about defragging on Macs:
http://www.macfixit.com/article.php?story=20070301091515843

Some forum link where someone asked for help defragging his Mac, and someone responded with the comment "You only need to "defrag" in Windows. It's not something you need to consider for the Mac.":
http://forums.macrumors.com/showthread.php?t=376408

Some crazy people talking about not defragging Macs:
http://forums.macrumors.com/showthread.php?t=481616

Wonderful information there:
You are also aware that a full defrag will actually slow down your system as it's far slower to read data from a single contiguous area on an HD rather than from several areas/platters simultaneously, yes?

I find it very strange that there is such little accurate information on this. The amount of denial is weird as well.


You can purchase iDefrag here: http://www.coriolis-systems.com/iDefrag.php