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.
8 thoughts on “Mac OS X Defragmenting”
Comments are closed.
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.
Generally defragging is not necessary on OS X and some people even frown upon it. DiskWarrior is a very popular app, good for rebuilding directories and such, not a defragging app though. It is a great repair app but also excellent as a preventive measure. It’s been used by Mac users for years and is still highly regarded. http://www.alsoft.com/DiskWarrior/ And the UNIX heavy web site MacOSXhints even gives it a 10 out of 10 http://www.macosxhints.com/article.php?story=20041011121127906
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.
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.
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–
‘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
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.
> 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.