Defrag?

Discussion in 'Mac Basics and Help' started by ghall, Oct 14, 2006.

  1. ghall macrumors 68040

    ghall

    Joined:
    Jun 27, 2006
    Location:
    Rhode Island
    #1
    What does defragging do exactly? Is it supposed to speed up the system?
     
  2. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #2
    Suppose you have fifty megabytes of files -- say an album you rip. You rip the album and these fifty megabytes of data get loaded in a block on the hard drive, say. Then you delete song six because you hate it. Now you have a fifty megabyte block with a 4 meg hole in the middle, right? The next time you make a new file, if it's bigger than four megabytes, the system puts it after the fifty meg block. But if it's smaller, it shoves it in that hole. Because if it didn't, then you would run out of space very quickly because you were not re-using space from deleted files (and your system is constantly making and deleting files so you wouldn't practically even get to fill the drive once).

    The problem with this is that each time there's a new file, the filesystem goes pecking through the space on the disk looking for a good place to put it. Which is time consuming.

    In older file systems, you manually defragmented the hard drive -- that is, you ran a program that went and looked for all the fragments of space and the small files and tried to packs all the files down so that all the free space is at the end in one giant block, so that this search is not necessary and disk access is faster.

    In more modern file systems like HFS, this is done on the fly for most files. You can read about this here. So for most users, going and running a defrag program won't help much. But if you want, why not? Knock yourself out. ;)
     
  3. BrianSalts macrumors regular

    Joined:
    Feb 25, 2006
    #3
    if i'm not incorrect, doesnt os x defrag your HD on the fly for you?

    therefore, i dont think you need to worry about anything :D
     
  4. ghall thread starter macrumors 68040

    ghall

    Joined:
    Jun 27, 2006
    Location:
    Rhode Island
    #4
    I don't think so, because I scaned my HD and it had some major defragmentation, and I mean MAJOR!
     
  5. dpaanlka macrumors 601

    dpaanlka

    Joined:
    Nov 16, 2004
    Location:
    Illinois
    #5
    Wouldn't that mean your hard drive was majorly not fragmented, and thus in need of no defragging?
     
  6. ddekker macrumors regular

    Joined:
    Sep 23, 2006
    Location:
    Michigan
    #6
    defrag

    just what did you scan you drive with to see it fragmented? Apples journaled file system takes care of it self, the only disk tool you have is "repair permissions" as far as I know

    DD
     
  7. pianoman macrumors 68000

    pianoman

    Joined:
    May 31, 2006
    #7
    Apple takes care of defragging small files but if you constantly work with things like movie files or even large pictures or large music files you probably should do a defrag.

    i don't know the exact file sizes, but a google search should reveal the specifics. defragging, contrary to many OSX users' belief, is not always unnecessary.
     
  8. ghall thread starter macrumors 68040

    ghall

    Joined:
    Jun 27, 2006
    Location:
    Rhode Island
    #8
    Good call.
     
  9. ghall thread starter macrumors 68040

    ghall

    Joined:
    Jun 27, 2006
    Location:
    Rhode Island
    #9
    I used iDefrag. It's a pretty nice program. http://coriolis-systems.com/iDefrag.php
     
  10. Counterfit macrumors G3

    Counterfit

    Joined:
    Aug 20, 2003
    Location:
    sitting on your shoulder
    #10
    The OS automatically defrags commonly used files under 25MB or so (last time I checked anyway).
     
  11. mad jew Moderator emeritus

    mad jew

    Joined:
    Apr 3, 2004
    Location:
    Adelaide, Australia
    #12
    No and yes. It needs less defragmenting because of the way HFS allocates space, but it still defrags on the fly.

    Third party defrag apps may give the impression that a drive is more fragmented than it actually is because the developers want you to use (and possibly buy) their app. I'm not saying this as a rule, just something to be wary of. :)
     
  12. backsidetailsli macrumors 65816

    backsidetailsli

    Joined:
    Aug 1, 2006
    Location:
    Toronto!
  13. Shadow macrumors 68000

    Shadow

    Joined:
    Feb 17, 2006
    Location:
    Keele, United Kingdom
    #14
    No, and you should never blight your iMac by getting one.
     
  14. Schroedinger macrumors regular

    Schroedinger

    Joined:
    Feb 12, 2004
    Location:
    Baltimore, MD
    #15
    Here's the thing with defragging under OS X, a small group needs to do it and they really need to do it. For example, I have a friend who downloads Hi Def torrents. Torrents are by nature highly fragmented. When watching one of these HD fragmented files, there are lags and delays that disappear once the file is defragmented and all in one place.

    I agree however that most users need not worry about it.
     
  15. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #16
    This is really interesting. I thought that when files are downloaded in general, the data was put in a temp download file until you got the whole file, and then it was re-written into a new file in order to avoid this issue. Like how Safari makes a .download file until a file is completed. So this is not quite right? Are large download files in general susceptible to fragmentation? Or is this specific to Torrent?
     
  16. disconap macrumors 68000

    disconap

    Joined:
    Oct 29, 2005
    Location:
    Portland, OR
    #17

    Torents are fragmented by nature; you are downloading bits and pieces. When you initially run the torrent (in, say, Azereus), there is a file set aside at the total size in the saved folder, so to the OS, the file is there (and usually identified as complete until you try to run it). The problem is that occasionally you get bad blocks that have to be corrected, cached duplicates, etc. It is rare that a torrent download is the same size as the specified size (in files over 100mb, at any rate). So the allocated space runs over and the bits of file are placed elsewhere.

    The part that I don't buy is that OSX needs to defragment files; the way Unix filesystems work is from the tree, not the space, so there is no searching, just a list of places the heads need to go to get the bits of files. I can see, when working with HD files, it just being too much for the drive, but in general defragging is unnecessary (and as was stated before, there is some minor auto-defragging that is part of the OS; this is why most people tell you to shut down your comp the minute you accidentally delete something, as the defragger and the RAM swapping can lead to it being overwritten very, very quickly).
     
  17. funkychunkz macrumors 6502a

    funkychunkz

    Joined:
    Jun 1, 2005
    Location:
    Ottawa, Canada
    #18
    From http://www.kernelthread.com/mac/apme/fragmentation/

    " On-the-fly Defragmentation

    When a file is opened on an HFS+ volume, the following conditions are tested:
    If the file is less than 20 MB in size
    If the file is not already busy
    If the file is not read-only
    If the file has more than eight extents
    If the system has been up for at least three minutes

    If all of the above conditions are satisfied, the file is relocated -- it is defragmented on-the-fly. "

    This is a great article from a guy who really knows what he's about. If you really want to defrag a mac (defragging involves some risk), I wouldn't personally use idefrag because it's been buggy in the past and uses proprietary algorithms. Drive Genius does a good job, but of all tools Disk Warrior, which rebuilds the catalogue file is speedy and makes a noticable difference.
     
  18. apfhex macrumors 68030

    apfhex

    Joined:
    Aug 8, 2006
    Location:
    Northern California
    #19
    Not always, but I don't think most users need bother with it.

     

Share This Page