Necessary to Defrag Hard Drive. HOW?

Discussion in 'macOS' started by zombie4000, Apr 12, 2007.

  1. zombie4000 macrumors newbie

    Apr 12, 2007
    Hello. As many know you must defrag your hard drive in windows often. I have had my mac for a while now and never saw a defrag tool. Is there a command line for terminal i can use to defrag the hard drive? Do you have to defrag macintosh based hard drives?
  2. WildCowboy Administrator/Editor


    Staff Member

    Jan 20, 2005
    Here is Apple's support document on the topic. Basically unless you routinely work with large files (>20 MB), there really isn't a need to defrag, since the OS does it automatically on the fly.

    But if you do need to defrag, you'd need a third-party utility. Since I don't defrag, I can't recommend one. :)
  3. gavd macrumors 6502a

    Jan 30, 2006
    As far as I'm aware, OS X does some system maintenance when the computer is idle which means you don't need to do this.

    Edit: Beaten to it.
  4. Kingsly macrumors 68040


    As WildCowboy said, OSX defrags on the fly. You may, however, want to repair disk permissions, as they tend to get confused, especially if you have lots of files (i.e. a huge photo library)

    From finder: choose Go > Utilities > choose the Disk Utility > select Macintosh HD (or whatever your HDD is names) and select "repair disk permissions".

    Some say it is good to do this more than once, as it finds stuff that it missed on the first try. I've never experienced this, though.
  5. yellow Moderator emeritus


    Oct 21, 2003
    Portland, OR
    I'm sorry I feel the need to do some correction here, but I don't mean to single you out Kingsly.
    You just happen to be the person that posted it.

    Permissions will only get "confused" because A) you or some other user is messing with them, B) an installation that requires an admin password has changed them, or C) a poorly-written or nefarious app on your Mac is mucking with them.

    A Permissions Repair (PR) reads the BOM (Bill of Materials) Archive from the receipts in /Library/Receipts/ for what the 'correct' permissions for directories related to that installer should be and compares them to what they are. If there is a difference, the permissions get "corrected".

    A PR does not descend into the /User hierarchy (typically).

    There's no need at all to run a PR as a maintenance. The only time it's advisable, is post installation of something that requires an admin password.

    And finally.. I wouldn't say that it "misses" some permissions repairs. More like there's a failure during the repair and re-running the repair will basically continue where it failed over.
  6. Kingsly macrumors 68040


    Thanks for explaining that, yellow. I've always be curious as to what exactly a PR does. That being said, I personally know a lot of professional photographers and they all agree (as well as the "experts" at Samy's camera and the Apple Store) that constant permissions repairs are a must when storing large batches of photos. I have had this happen to me many times, where a permissions repair magically fixes all my problems when operating huge Aperture or iPhoto libraries and is needed about once every two weeks, or when the computer gets sluggish.

    Attached Files:

    • dunno.gif
      File size:
      275 bytes
  7. yellow Moderator emeritus


    Oct 21, 2003
    Portland, OR
    I can only agree with your shrug. That makes no sense. :confused:

    Caveat being, I don't use Aperture, and my iPhoto lib is only a couple gigs large. But at least I can look at the BOM for iPhoto and report. Without Aperture, I cannot.
  8. yellow Moderator emeritus


    Oct 21, 2003
    Portland, OR
    OK, here it is. The entire permissions contents of /Library/Receipts/iPhoto_606.pkg. Unfortunately, it's 17658 characters too long. So here it is in a flat text file.

    My first thought is that their perception is just that.. a percieved change for the better and that nothing is actually changing. I guess the real test would be... repair permissions today. Install nothing. Use the app as much as possible. Repair permissions tomorrow. Is there any output related to the app in question? If so.. find out what is changing permissions "illegally"?

    For those that might be curious how I got those, investigate the "lsbom" command in the Terminal.

    Attached Files:

  9. daneoni macrumors G4


    Mar 24, 2006
    Yes OS X takes care of itself but sometimes it needs help. I use this for that help.
  10. Jimmieboy macrumors 6502


    Oct 30, 2005
    I believe there are three maintence commands that are taken by OS X.

    I think that one occurs everyday, one every week and one every month.

    I think they happen at an unusal time, like 3 in the morning.

    I'm not 100% sure out this so feel free to correct me! :)
  11. spork183 macrumors 6502a


    Jul 30, 2006
    yep, there are daily/weekly/monthly maintenance and I use to know the handy terminal language to trigger them, but I've forgotten. Something like

    sudo periodic daily/weekly/monthly

    I'm sure that's wrong, but I'm also sure someone here knows that cold and can correct it...
  12. SMM macrumors 65816


    Sep 22, 2006
    Tiger Mountain - WA State
    When I began to administer my first Unix network (Solaris 2.0), I was pleased to learn that I did not have to run a nightly defrag script, as I did with Novell and FAT file systems.

    I used to check the system health every morning like clockwork. The UFS never reached 3% fragmentation, usually remaining at 2.5%. My company ran a very sophisticated MRPII system. It relied heavily on optimum database performance.

    On my personal computer, I ran OS/2 (not wanting to feel assimilated). HPFS was pretty solid as well. AHFS is even more technologically advanced. I notice that the percent of fragmentation is even reported. So I doubt if anything would be gained from running a utility, except for peace of mind. That is a personal choice.

    I would note that I too work with large graphic files. I have a workflow in which I capture video to a dedicated drive on my MP. After capture, it is moved to another drive for post production work. When complete, the final product is dispersed to several different external drives. The bottom line is, I too am moving a lot of large file around.
  13. yellow Moderator emeritus


    Oct 21, 2003
    Portland, OR
    No slashes.

    sudo periodic daily weekly monthly

    (or any combonation of the daily/weekly/monthly entry)
  14. slooksterPSV macrumors 68040


    Apr 17, 2004
    If you feel your computer is running slowly. Update the prebinding, use a tool like Onyx to help with all that. I'm not saying Prebinding will fix it, but it does make it a bit faster.

Share This Page