11 Replies Latest reply: Dec 5, 2012 8:06 PM by ds store
R. Toby Richards Level 1 Level 1 (0 points)

Yes, I have read the official Apple Support document about why I don't need to defragment my Mac (http://support.apple.com/kb/HT1375). I've also read many third party articles about this. I get it, yet I think I may have a case for an exception:

 

I work with lots of virtual machines. Now, unless I want to waste time pre-allocating disk space then I have to use dynamically sized disks of 32 or more GB. One of the things that HT1375 says is this:

 

Fragmentation was often caused by continually appending data to existing files, especially with resource forks. With faster hard drives and better caching, as well as the new application packaging format, many applications simply rewrite the entire file each time. Mac OS X 10.3 Panther can also automatically defragment such slow-growing files. This process is sometimes known as "Hot-File-Adaptive-Clustering."

 

First of all, I have read that "Hot-File-Adaptive-Clustering" went away in 10.6. Secondly, "simply [rewriting] the entire file each time" isn't going to be a viable option for files that are dozens of GB in size. I also understand that OSX compensates for fragmentation in other ways, such as "read-ahead and write-behind caching". The problem is that the virtual OS does not. I can defragment its virtual hard drive, but that dosn't do a lot of good when the file that *is* the virtual hard drive itself is fragmented.

 

So let's have it: are there exceptions to the standard answer to defragging a Mac? If so, then can it be done without great difficulty?


MacBook Pro, OS X Mountain Lion (10.8.2)
  • 1. Re: Exceptions to HFS  not needing defrag?
    Lanny Level 5 Level 5 (4,485 points)

    Clone it, erase the source, and then clone it back.

  • 2. Re: Exceptions to HFS  not needing defrag?
    R. Toby Richards Level 1 Level 1 (0 points)

    I know that method, which is why I included the requirement to include "...without great difficulty."

  • 3. Re: Exceptions to HFS  not needing defrag?
    steve359 Level 6 Level 6 (12,040 points)

    Hardly difficult.  Time-consuming, and a skill you should learn sooner (now) rather than later (OMG! HD crashed!).

     

    As Csound1 said, fast.  The "time consuming" is the time needed for the transfer to take place, not the time needed to set up the restore.

     

    I have doen it before, and waiting for it to finish is the longest part.

  • 4. Re: Exceptions to HFS  not needing defrag?
    Csound1 Level 8 Level 8 (35,365 points)

    Lanny gave you the simplest, safest method (fast too) why would you want to make it harder?

  • 5. Re: Exceptions to HFS  not needing defrag?
    R. Toby Richards Level 1 Level 1 (0 points)

    Yes. Time-consuming. Listen (I don't want to sound abrasive, but I must establish my credentials):

     

    1) I have no problem re-installing from scratch at a whim. Anything that I need to keep is either in the cloud or on my employer's backed-up servers (all of which I'm the sysadmin of).

     

    2) I do have the skill. In addition to Time Machine backup/reset/restores, I've worked with Clonezilla, Symantic Ghost, Altiris (before it was Symantec), DiskImage, DriveImageXML, ImgMaker, dd, raw2write, and Disk Nibbler (for those pesky DRM'd Commodore 64 games on 5.25" floppies).

     

    Is there or is there not a Mac or BSD utility/procedure that defragments HFS+ (even if I have to compile it from source, or use DarwinPorts/Fink/Homebrew, or read a man page, or some other such thing)?

  • 6. Re: Exceptions to HFS  not needing defrag?
    steve359 Level 6 Level 6 (12,040 points)

    Defragging an active system, in-place, is tricky.

     

    I would only fix my disk "offline".

     

    And any major file moves cannot guarantee the best free-space use.

     

    Clone, format, clone back.  I would.

     

    I am exiting this conversation.

  • 7. Re: Exceptions to HFS  not needing defrag?
    Csound1 Level 8 Level 8 (35,365 points)

    R. Toby Richards wrote:

     

    Yes. Time-consuming. Listen (I don't want to sound abrasive, but I must establish my credentials):

     

    1) I have no problem re-installing from scratch at a whim. Anything that I need to keep is either in the cloud or on my employer's backed-up servers (all of which I'm the sysadmin of).

     

    2) I do have the skill. In addition to Time Machine backup/reset/restores, I've worked with Clonezilla, Symantic Ghost, Altiris (before it was Symantec), DiskImage, DriveImageXML, ImgMaker, dd, raw2write, and Disk Nibbler (for those pesky DRM'd Commodore 64 games on 5.25" floppies).

     

    Is there or is there not a Mac or BSD utility/procedure that defragments HFS+ (even if I have to compile it from source, or use DarwinPorts/Fink/Homebrew, or read a man page, or some other such thing)?

    30 minutes to reinstall, maybe 35, that's too long for you .....

     

    Buy iDefrag, like other Mac defrag utilities it is useless, but it's fast at being useless.

  • 8. Re: Exceptions to HFS  not needing defrag?
    R. Toby Richards Level 1 Level 1 (0 points)

    Yeah, but I can't make an image, and then reinstall that image interaction-free every other time I add a lot of data to my VM's drive.

  • 9. Re: Exceptions to HFS  not needing defrag?
    Csound1 Level 8 Level 8 (35,365 points)

    R. Toby Richards wrote:

     

    Yeah, but I can't make an image, and then reinstall that image interaction-free every other time I add a lot of data to my VM's drive.

    Increment your images faster, daily at least.

  • 10. Re: Exceptions to HFS  not needing defrag?
    BobHarris Level 6 Level 6 (13,110 points)

    There are no build-in defragmentation utilities.  I have read about some 3rd party defragmentation utilities, but I have zero experience with them (try google "Mac defrag").  And because generally Mac OS X general masses do not need, I do not see much discussion about these 3rd party utilities.

     

    The Virtual Machine container file is a good example of where a contiguous file would be beneficial.  So are situations were video streaming (or audio) if enough of it is being done, can benefit from contiguous storage.  However, these are not really the typical "Mom, Dad, Timmy and Sue" consumer Apple markets to.

     

    There are always exceptions to anything.  Apple just tries to make the majority of their users not need to worry about the exceptions.

  • 11. Re: Exceptions to HFS  not needing defrag?
    ds store Level 7 Level 7 (30,305 points)

    Did you save any virgin snapshots of the original VM installs?

     

    Because you can always dump your files off out of the fragmented VM and then revert to one of the earlier snapshots and update it/whatnot and return the files.

     

    User files is what's the bug culprit for deoptimization/framentation on hard drives, because when they are in the way, OS updates and program installs go further down on the drive were the performance suffers more.

     

    Then when that's complete to the clone reverse clone method, yes I know you've heard this one before

     

    It really works and it's effortless if your off doing something else for instance, plus you always have a bootable backup.

     

    How to safely defrag a Mac's hard drive