Subscribe to
NSLog(); Header Image

Defragging a Mac Drive

A friend of mine has 220 GB of data (music) on a 250 GB disk. He'd like to defragment the disk but isn't sure what options are available and doesn't have the space to do a "drag, erase, copy back" defragmentation. I also seem to recall Mac OS X 10.4 automatically defragmenting files under 20 MB - perhaps turning that feature off can speed up file writes. You see, he's noticing a 6-second (or more) delay when he changes a song's ID3 tags in iTunes.

What tools do you recommend and/or use for defragmenting files in Mac OS X? How might you solve this problem beyond defragmenting?

8 Responses to "Defragging a Mac Drive"

  1. There's an article on the Apple Blog about this issue. I don't know if defragging is going to do anything for him...

  2. I don't know that it will. His iTunes files are 42 and 23 MB. I think it has more to do with paging in and out. But this is all worth a shot, and the information can come in handy for other individuals.

  3. You know, I'm not sure I would bother, if he cannot actually back them up on another disk first. What if the defrag actually turns into a frag fest, that is, corrupting everything?

    With that amount of headroom, I would be leaning towards moving to another larger disk anyway. It takes long enough to rip enough songs to fill a disk of even HALF that capacity of his current library. That is, he really doesn't have the headroom on THAT disk to do much reshuffling to defrag.

    I speak as one whose iTunes library, on its own disk, about 120 gig, suffered a hard disk crash at least a year ago. I simply haven't had the time to bother rebuilding it since. Drivesavers would not even look at it for under 800 dollars.

    Buy another larger drive, (or at least one of similar capacity) and let the copy do the defrag.

  4. I am seeing similar lockups, especially when doing disk intensive tasks like compiling which usually causes the entire system to lock up.

    I think iTunes is just telling me to cull all the songs that I don't listen to although moving the database to sql would be brilliant.

  5. I use iDefrag with some happiness. It's more important to have free space than anything else. Once you get less than 25% disk free, osx fragments at an increasing rate.

    iDefrag has a lot of options, but one I like is booting with a firewire volume so I can wreak havoc on the internal drive, then rebooting back. You could do the same with a bootable dvd + iDefrag on the image to keep from "misusing" your bootable backup. It's amazing what a difference it makes. NeXTSTEP has always been IO-bound, and slowing down your HFS+ drive with fragmented files just makes it drag. My new mac (late 2005 pb instead of aug 2003 pb) seemed so much faster than my old one precisely because it was clean and unfragmented.

    A full defrag takes a lot of time, so even the "Quick (online)" defrag, which is basically,"which user files are broken up into parts? Let's move them together!" is an improvement.

    I can't believe, after 12 solid years of running defraggers on DOS, NT, and Win2k/XP, that I really bought that defragmenters were unnecessary on OS X.

  6. the pause in itunes has nothing to do with the disk being fragmented. if your friend has their entire music library inside itunes, then whenever itunes changes state, it has to write out the DB and the XML file. with 250GB of music, that takes more than a few seconds.

    on my list of todos is writing a script that creates a temporary RAM disk with the itunes library in it to try and alleviate this annoying situation.

  7. Justin, such a script wouldn't help very much. Writing the database is very, very quick and easy. However, the actual MP3/AAC/etc. file also has to be re-written to the disk to include the additional ID3 tags and information.

    Given that we can listen to the disks to see which one's grinding, and given that both of us were or are Mac Geniuses and/or software developers, we're pretty confident in our diagnoses that the fragmentation is a significant portion of the problem.

    The other portion - about half - is a small paging problem.

  8. erik, upon re-reading your original post, i see you are talking about an entirely different problem (changing the ID3 tags vs. my problem of huge itunes DB). sorry for the blabbering. that's what i get for speed reading 😉