10 Replies Latest reply: Jan 23, 2010 12:35 PM by Rod Hagen
blueheron11 Level 1 Level 1 (0 points)
Hi Guys,

I have a question - do I need to defragment my iMac? I have noticed it is getting slower.


iMac, Mac OS X (10.6.2)
  • jamesholden Level 3 Level 3 (710 points)
    No. There is no need to defragment, that's only required for those running Windows.

    To try an get to the bottom of the slowness you can run the activity monitor and see if anything is really hammering the disk usage, or eating up lots of ram and cpu.
  • dwb Level 7 Level 7 (21,795 points)
    As James said, defragging the drive is something we seldom need to do in MacLand. Yes, some people do find it necessary but the typical home user doesn't. When people complain of slow computers the first thing I ask is how much RAM they have and how many programs (and what programs) they are running. The second question I ask is whether the computer runs fine when it is first turned on and then slows down over time. Both questions are asked with too little RAM in mind.
  • macbig Level 4 Level 4 (1,680 points)
    You should also take a look at how much HD free space you have. I would not recommend running Mac OS X with less than 10% free space remaining on your startup volume. The free space is used for hidden swap files that Mac OS X needs do to virtual memory, and for other temporary files used by the system. Once free space gets low, the remaining free space becomes more and more fragmented into small pieces. That makes it hard for Mac OS X to operate efficiently.
  • MGW Level 7 Level 7 (27,020 points)
    If your Mac is slowing down, use OnyX to clear your caches, that should speed things up.

    Photo Sharing and Video Hosting at Photobucket
  • Klaus1 Level 8 Level 8 (46,960 points)
    Just to add a footnote to the good advice you have already had:

    Defragmentation in OS X:


    Slowness could be caused by your hard disk not having enough unused space.
  • Rod Hagen Level 7 Level 7 (31,985 points)
    Well, I'm going to put a contrary view to others you have received here, blueheron.

    Most users, as long as they leave plenty of free space available , and don't work regularly in situations where very large files are written and rewritten, are unlikely to notice the effects of fragmentation on either their files or on the drives free space much.

    As the drive fills the situations becomes progressively more significant, however.

    Some people will tell you that "OSX defrags your files anyway". This is only partly true. It defrags files that are less than 20 MB in size. It doesn't defrag larger files and it doesn't defrag the free space on the drive. In fact the method it uses to defrag the smaller files actually increases the extent of free space fragmentation. Eventually, in fact, once the largest free space fragments are down to less than 20 MB (not uncommon on a drive that has , say only 10% free space left) it begins to give up trying to defrag altogether. Despite this, the system copes very well without defragging as long as you have plenty of room.

    Again, this doesn't matter much when the drive is half empty or better, but it does when it gets fullish, and it does especially when it gets fullish if you are regularly dealing with large files , like video or serious audio stuff.

    If you look through this discussion board you will see quite a few complaints from people who find that their drive gets "slow". Often you will see that say that "still have 10 or 20 gigs free" or the like. On modern large drives by this stage they are usually in fact down to the point where the internal defragmentation routines can no longer operate , where their drives are working like navvies to keep up with finding space for any larger files, together with room for "scratch files", virtual memory, directories etc etc etc. Such users are operating in a zone where they put a lot more stress on their drives as a result, often start complaining of increased "heat", etc etc. Most obviously, though, the computer slows down to a speed not much better than that of molasses. Eventually the directories and other related files may collapse altogether and they find themselves with a next to unrecoverable disk problems.

    By this time, of course, defragging itself has already become just about impossible. The amount of work required to shift the data into contiguous blocks is immense, puts additional stress on the drive, takes forever, etc etc. The extent of fragmentation of free space at this stage can be simply staggering, and any large files you subsequently write are likely to be divided into many , many tens of thousands of fragments scattered across the drive. Not only this, but things like the "extents files", which record where all the bits are located, will begin to grow astronomically as a result, putting even more pressure on your already stressed drive, and increasing the risk of major failures.

    Ultimately this adds up to a situation where you can identify maybe three "phases" of mac life when it comes to the need for defragmentation.

    In the "first phase" (with your drive less than half full), it doesn't matter much at all - probably not enough to even make it worth doing.

    In the "second phase" (between , say 50% free space and 20% free space remaining) it becomes progressively more useful, but , depending on the use you put your computer to you won't see much difference at the higher levels of free space unless you are serious video buff who needs to keep their drives operating as efficiently and fast as possible - chances are they will be using fast external drives over FW800 or eSata to compliment their internal HD anyway.

    At the lower end though (when boot drives get down around the 20% mark on , say, a 250 or 500 Gig drive) I certainly begin to see an impact on performance and stability when working with large image files, mapping software, and the like, especially those which rely on the use of their own "scratch" files, and especially in situations where I am using multiple applications simultaneously, if I haven't defragmented the drive for a while. For me, defragmenting (I use iDefrag too - it is the only third party app I trust for this after seeing people with problems using TechToolPro and Drive Genius for such things) gives a substantial performance boost in this sort of situation and improves operational stability. I usually try to get in first these days and defrag more regularly (about once a month) when the drive is down to 30% free space or lower.

    Between 20% and 10% free space is a bit of a "doubtful region". Most people will still be able to defrag successfully in this sort of area, though the time taken and the risks associated increase as the free space declines. My own advice to people in this sort of area is that they start choosing their new , bigger HD, because they obviously are going to need one very soon, and try to "clear the decks" so that they maintain that 20% free buffer until they do. Defragging regularly (perhaps even once a fortnight) will actually benefit them substantially during this "phase", but maybe doing so will lull them into a false sense of security and keep them from seriously recognising that they need to be moving to a bigger HD!

    Once they are down to that last ten per cent of free space, though, they are treading on glass. Free space fragmentation at least will already be a serious issue on their computers but if they try to defrag with a utility without first making substantially more space available then they may find it runs into problems or is so slow that they give up half way through and do the damage themselves, especially if they are using one of the less "forgiving" utilities!

    In this case I think the best way to proceed is to clone the internal drive to a larger external with SuperDuper, replace the internal drive with a larger one and then clone back to it. No-one down to the last ten percent of their drive really has enough room to move. Defragging it will certainly speed it up, and may even save them from major problems briefly, but we all know that before too long they are going to be in the same situation again. Better to deal with the matter properly and replace the drive with something more akin to their real needs once this point is reached. Heck, big HDs are as cheap as chips these days! It is mad to struggle on with sluggish performance, instability, and the possible risk of losing the lot, in such a situation.


  • Rod Hagen Level 7 Level 7 (31,985 points)

    If you want to check the level of file and free space fragmentation on your drive you can either download the "trial" version of iDefrag, or use a useful little free utility called ShowVolumeFragmentation from http://www.macupdate.com/info.php/id/18451

    It is a smaller download than the idefrag trial, so you might want to try it first. It also has a useful graphic display and information about the meaning of different results.
    (It is a little more complex to install though - involving downloading and installing an addition item - hfsdebug - a link is provided for this by the program).

    Note that on very badly fragmented drives even just checking for fragmentation can take a while, so have a cup of coffee while it does the job!)

    Fragmentation of Mac drives when they get low on space is a more serious issue than many recognise. Not only does it result in slow downs, and , in extreme cases, have the potential to result in very serious corruption issues beyond the ability of regular utilities to resolve, but it also adds unnecessary wear and tear to the drive itself, and increases drive operating temperatures - something very undesirable on a computer like the iMac G5 which runs its HD's pretty hot at the best of times!



    Message was edited by: Rod Hagen
  • WZZZ Level 6 Level 6 (12,775 points)
    The first really useful rundown on OSX and fragmentation I have read. Excellent. I am bookmarking it. Dispels some of the myths. Thanks.
  • WZZZ Level 6 Level 6 (12,775 points)
    One thing I would want to add is that, at least using Carbon Copy Cloner (but probably other cloning apps as well), reverse cloning will automatically defragment everything. This can be very useful when going to a bigger drive from a previously very crowded one--or when reverse cloning to a drive that has been cleaned out sufficiently.

    I was very happy to learn this a few years ago when I reverse cloned to a 160 after getting down to just a few MB left on the original G3 10 GB drive. Talk about thin ice!
  • Rod Hagen Level 7 Level 7 (31,985 points)
    THanks WZZZ,

    Yes, cloning and then reverse cloning is, indeed a way to deal with the issue. I mentioned doing this with SuperDuper, but CCC will work also. The Shirt-Pocket software people, who produce SuperDuper, have a useful pdf file (74kb) on the basic process involved here.

    Another thing which I failed to mention are the problems that can ensure when installing any large OS update on a drive with little space. Installing an update can often involve the writing and rewriting of a 100,000 files or more. If the drive has little room, or already has badly fragmented free space, this can very substantially increase the level of fragmentation, not just of free space but of directories and the like. Along with problems caused by installing an update on a drive with already corrupted directories or system files it plays a significant part in the issues we always seem to see here after new updates are released.