Slashdot Mirror


Mac OS X 10.3 Defrags Automatically

EverLurking writes "There is a very interesting discussion over at Ars' Mac Forum about how Mac OS X 10.3 has implemented an on-the-fly defragmentation scheme for files on the hard drive. Apparently it uses a method known as 'Hot-File-Adaptive-Clustering' to consolidate fragmented files that are under 20 MB in size as they are accessed. Source code from the Davwin 7.0 Kernel is cited as proof that this is happening."

5 of 181 comments (clear)

  1. Re:Amortized cost... by clifyt · · Score: 5, Interesting

    "Drives are defragged to allow the OS to access the files faster."

    Are you so sure?

    I have talked with a senior OS designer (one of the non-free ones) and his view is that these days, defragging does more damage than it saves.

    Why? Drives generally have large caches on them and multiple platters / read heads.

    Noting this, the fastest way to get data off a drive might not be a straight line. Its looks pretty when you run the different utilities and makes the home makers of whom believe everything should be put away neat and tidy, but the engineer had mentioned that being defragged means you loose a lot of advantages of those multiple readheads and cache. He claimed that it was actually better to leave your drive to its own devices, allowing for about 30% free space at all times, and you will see a speedup over a defragged drive.

    I didn't believe it at first, but his arguments did make a lot of sense even though it went against everything I had learned before. He actually mentioned if he had his choice, he'd make certain defraggers would NEVER work, but the market believes that these are necessary so its easier to have these things included as well as supporting third parties, so its there.

  2. Autodefrag. (snort) by speechpoet · · Score: 5, Funny

    In my day, we'd crack open the drive on our Mac SE30s, sharpen a magnet on a whetstone, and defrag that sucker by hand.

    Kids these days. It's the MTV, ya know - makes 'em lazy.

  3. Re:Amortized cost... by bdsesq · · Score: 5, Insightful

    Noting this, the fastest way to get data off a drive might not be a straight line.

    This is true. However it is also true that a defrag does not have to put the data in physically contigious blocks. It can just as easily put the data in whatever configuration makes retrevial work fastest on that particular drive geometry.

    This means that an intelligent defrag can improve performance.

  4. Re:In other news.... by Teese · · Score: 5, Informative

    Its a just recently added feature!

    See the -s option for newfs_hfs:

    (from man newfs_hfs)

    -s

    Creates a case-sensitive HFS Plus filesystem. By default a case-insensitive filesystem is created. Case-sensitive HFS Plus file systems require a Mac OS X version of 10.3 (Darwin 7.0) or later

    --
    "I'm a Genius!"*


    *Not an actual Genius
  5. Not quite right (clarification) by ploiku · · Score: 5, Informative

    The summary appears to not be quite right.

    To clarify, there are 2 separate file optimizations going on here.

    The first is automatic file defragmentation. When a file is opened, if it is highly fragmented (8+ fragments) and under 20MB in size, it is defragmented. This works by just moving the file to a new, arbitrary, location. This only happens on Journaled HFS+ volumes.

    The second is the "Adaptive Hot File Clustering". Over a period of days, the OS keeps track of files that are read frequently - these are files under 10MB, and which are never written to. At the end of each tracking cycle, the "hottest" files (the files that have been read the most times) are moved to a "hotband" on the disk - this is a part of the disk which is particularly fast given the physical disk characteristics (currently sized at 5MB per GB). "Cold" files are evicted to make room. As a side effect of being moved into the hotband, files are defragmented. Currently, AHFC only works on the boot volume, and only for Journaled HFS+ volumes over 10GB.