Mac OS X Defragmenting

Posted on March 19, 2005
Filed Under macintosh | 8 Comments

I’ve never needed a defrag program for one of my Macs before, but this constantly recording and filling up my hard drive is producing noticeable degradation of disk performance. What tools are good for this thing? Keep an eye towards the value/price ratio. Are there good free ones? I see that Micromat has one that is $100 – is that worth the money? I know nothing about any of these so please help a pal out.

Comments

There is a posted comment policy for this blog. Please respect the rules.

8 Responses to “Mac OS X Defragmenting”

    Comment Permalink
  1. ryan king on March 19th, 2005 3:25 pm

    Unfortunately, there aren’t really any good defrag tools for HFS. That’s mostly because Mac OS X does a pretty good job of avoiding fragmentation most of the time.

  2. Comment Permalink
  3. Tom on March 19th, 2005 9:01 pm
  4. Comment Permalink
  5. Tom on March 19th, 2005 9:08 pm

    By the way Dave, there’s about 50 replies to the original post on the Macosxhints page I liked to above. If you are not familiar with DiskWarrior reading through some of those posts will inform you quite a bit as to what it does and how experienced Mac users feel about it.

  6. Comment Permalink
  7. Paul on March 19th, 2005 9:36 pm

    Dave,

    I like Tech Tool Pro and Disk Warrior. One thing to keep in mind is that, the more room you have open on your hard drive, the less time defrag/optimization will take. I try to follow a general rule to keep at least 35-40% of space open on my hard drive or else optimization can take days. Literally.

  8. Comment Permalink
  9. Ken Nelson on March 20th, 2005 10:31 am

    Hey, Dave:
    I don’t know much about the robustness of OSX command-line disk utilities, but if they are OK, you could do domething like:
    1) Backup the data of interest
    2) newfs the partition where that data resides, and then
    3) restore the data to the new partition.

    This could me made even slicker if you have 2 identically-sized disk partitions, call them A and B.
    newfs both of them, and copy the data of interest to partition A. Call A the active partition. Then periodically, from cron do something like:

    echo y | newfs /PartitonB
    cd /partitionA
    tar cf – * |( cd /partitionB; tar xf -)
    .

    PartitionB is now active, use until it exhibits undesirable symptoms, then repeat the above, exchanging PartitionA and B’s roles.
    A then becomes active again.

    As I said, I don’t know about OSX’s disk utility robustness, but if the above is doable, it’s no monetary cost.

    There newfs options that let you control bytes per inode, as well as fragmentation size; those may be of use as well.
    –Ken–

  10. Comment Permalink
  11. mikeyg on May 6th, 2005 3:31 pm

    ‘defragging’ on OSX should be unneccessary. newfs may be helpful, but partitioning off your drive may be a more permanent solution. keep the system and not-so-often changed files on one partition, and place your library of often-changing files on another.

    For more partitioning information, check MacOSXhints

  12. Comment Permalink
  13. bob h on August 25th, 2005 9:28 am

    I have had some specific files that needed defragging, such as my /Library/Safari/Bookmarks.plist file that holds my bookmarks for Safari. Files that are updated often are most likely to be fragmented.

    When I got the beachball every time I accessed my bookmarks in Safari, I copied all of the files in my ~/Library to an external hard drive, then deleted the original and copied it back (note that I’m talking about the Library directory under your home directory, not the Library directory in the root). It was a bit scarry since about 6 files were in use, but I was able to restore it (some Finder files had to be recopied manually). I no longer get the beachball when I click on the Safari Bookmarks menu.

    Hey Ken Nelson:
    You may want to read about some programs that will help to make better copies than tar since tar may not capture all of the file attributes like comments (entered in Finder), and the color labels that you can apply to files in Finder. Look for programs called ditto (comes with OS X) and xtar (made by Helios). These are better if you are about to hack up your whole drive… and remember to run these under the root user ID so that it has the authority to copy everything and retain the original user ID and dates on all of the files.

  14. Comment Permalink
  15. Rithban on November 1st, 2006 10:08 pm

    > tar may not capture all of the file attributes

    According to what I read in Singh’s “Mac OS X Internals” earlier this week, as of OS 10.4, tar, rsync, mv, and related command-line Un*x tools correctly handle resource forks , comments, and other metadata attached to files.