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."
Can it open a beer for me?
Obviously doing this process slows down file access a little. I wonder whether any safeguards are in place, such as turning the system off after a certain I/O load is reached? If not, this may not be such a good idea.
Also, I wonder whether if you were to calculate the extra time (perhaps 500ms) to defragment each fragmented 20MB file against doing a manual defrag every month, and whether it's actually worth it...
Don't some Linux filesystems already do this to some extent? I could be hallucinating again, but I'm sure I read this somewhere.
I'd still like to defragment larger files even if it's done manually. Plus Optimizer requires a reboot.
>80 column hard wrapped e-mail is not a sign of intelligent
>life
I also wonder how well Ars OpenForum will hold up to a Slashdotting. They run Infopop Opentopic which is Java backed by Oracle on clusters, so I'd imagine pretty darned well. Then again, it's still dynamic content with a bigass XSL (XML to HTML) transform on the top before it reaches the browser...
Darwin is welcomed to 1980's filesystem technology. But instead of defraging FFS just makes better decisions as to where to put files. This also explains why the hard drive on my iBook seems alot hotter since upgrading. Seriously, if Apple got rid of HFS, none of this technology would be necessary.
ahh shucks.
"Slashdot, where telling the truth is overrated but lying is insightful."
I think it's a battery-saving feature for the new PowerBooks...
"Flyin' in just a sweet place,
Never been known to fail..."
GREAT, if one ever had to defrag with HFS+
I'm in two minds about this. One, it's a potentially good thing to keep a filesystem constantly running well, but Secondly, I've never had one single process kill more partitions in the last ten years of using computers than when I was defragmenting them. That's my biggest concern.
If I were to get a Mac I'd hope a feature like this could be turned OFF permanently. I'm not one for just using a machine and spontaneously having an unreadable drive.
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.
MacOS FileID's?
Are they comparible to what Reiser4FS will have? Are they better that XYZ offering in Linux?
I'm seriously interested in what EXACTLY they are. Please spare the fanboy attitude if you do wish to answer..
According to the ARS writeup, this feature is on only when journalling is on. This makes total sense, since journalling prevents an incomplete or unverified write from being used.
Some drink at the fountain of knowledge. Others just gargle.
Can you not install Mac OS X on a UFS partition?
Well that's fine. The real upside of this is for people that have never heard of /. and don't really know what a hard drive is, let alone know how to defrag one.
Previously these people would just go forever without defragging. Now they can still do that, because Apple is doing it for them behind the scenes.
This is yet one more example of Apple's winning philosophy: Keep it simple, make it better.
A Multiplayer Strategy Game for Mac OS X, Windows, and Linux
That's gonna mess up my UT 2003 ranking! I work hard for those frags! Every one of them!
There exists no way of exchanging information without making judgments. --Bene Gesserit Axiom
Windows XP has a similar feature that waits a until the computer is not in use for a certain amount of time. It would make sense that Apple would give users the same option.
I think I think, therefore I think I am.
Try this...
...and this...
The source code is posted to that thread; the only conditions are (1) 3 minutes after the system time starts (i.e. avoid doing so when booting up), (2) less than 20 MB of size, (3) file isn't already opened.
The only negative consequence is a possible speed hit, though. There's no danger.
I'm pretty impressed by this. Sure, it's been done before. Sure, there are more elaborate methods. But this is just a simple little lump of code that'll defragment the worst files most of the time.
Hi,
I installed Darren 7 on my Power Mac G3/450. It is so blazing fast in text mode, I can't fathom why Mac OS X lags so slowly. I can't wait for 7.1, which should be in line with FreeBSD 4.9!
Seeya later,
M4C H4ck4R
I guess that your experience must just be the one and only possible way that ALL of us experience Panther, right? You really come off as a troll just LOOKING to start a useless little flame war....tsk tsk
this should defrag all of the 20M or less files on your hard drive.
it locates every file, opens it and reads every bite then closes it.
This should force the defragger to run on all files under 20M. Not that technically the defragger only activates when the file is broken into more that 8 extent regions. So this does not actually defrag everything.
but its also possible that having the file broken into less extents is harmless. first because the the first 8 extents are the fasttes to access in HFS+ and second its theoretically possible that on a multi-headed disk drive that having the file slightly fragmented might be good. Larger numbers of frags than read head would be bad of course
Some drink at the fountain of knowledge. Others just gargle.
Notice that the defragger only activates if the file is fragmented more than 8 ways. thus this mutli-read head issue is already accounted for. if you fragment the file into more extents than you have read heads this would presumably be bad. but perhaps 8 is the optimal number or close to it? its also faster because of the way hfs stores the file table that beyond 8 the lookup time increases.
Some drink at the fountain of knowledge. Others just gargle.
I'm Not sure the windows approach is really better. Notice that the apple approach is more minimalist in moving files.
Some drink at the fountain of knowledge. Others just gargle.
>Not if you do it intelligently (copy data, compare to original, delete original as an atomic operation).
err no. you're showing a fundamental misappreciation of the problem. Every time you move a file you risk corrupting it.
It does not matter if you double check what you wrote, because that only decreases the chance of making an error. it does not eliminate it. you might make the same read error twice in a row.(e.g. to make this plausible imagine say a weak magnetization that flips after a temperature change later that night). or perhaps you may have read the file wrong in the first place. or something might go wrong when you are updating the file allocation table or there might be some bug in the code that makes an error.
the point is that if you just left the file alone inthe first place its safer.
thus the apple approach of only defragging a file in active use and leaving all the other's alone may be preferred to a blanket de-fraggmenting of a disk.
furthermore, when was the last time you tried de-fraggmenting a 500GB disk? do you have any clue how many days this would take??? The apple approach of doing it just-in-time makes a lot of sense. It follows the same logic as jounaling, which is in part a response to no having to fsck a 500GB disk.
Good thing it doesn't defag. Otherwise Apple would lose a large part of their market.
..at full speed.
Thank you Apple for thinking of my porn needs.
If the file is "cloned" on opening and the user then closes it and performs a "secure empty trash", didn't this "feature" just leave a copy of the data behind that could be reconstructed?
That defeats the purpose of "secure empty trash". It doesn't matter to me, I like the idea, but maybe someone else wants the option to disable it for security reasons.
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.
I'm a bit less sure of this one, but I think the file must be severely fragmented (i.e. into 8 pieces).
Maybe you can even lock down the forums some more and not provide any more benefits for subscriptors beyond PDF's of the main articles (I'm sure people were clamoring for that one).
WOW THAT'S SOME SERVICE. WHERE DO I PAYPALZ THE MONIEZ? (@)>
No need to get defensive. I was just trying to suggest that Apple would have a setting that would wait until the computer was not being used. Apparently you feel threatened by the mere mention of Windows. If you ask me the whole PC/Mac debate is going nowhere. It's just a juvenile pissing contest.
I think I think, therefore I think I am.
Alright, there ARE multiple heads, but there is still only 1 head to each platter-surface, and all the heads on all the platters are connected at the base, so they cannot move independently. You ARE better off defragged than not, but even better would be to 'arrange' files based on access paterns.
I tell you this, I notice quite a speedup after I perform a full-backup-and-restore, the only way to defrag most Linux filesystems. I saw loading OpenOffice take 7 seconds before, and 3 after.
When I load Mozilla it has to read in a LOT of other files, a proper filesystem would log that and try to move those files closer to each other. ReiserFS is trying to implement something like this, I believe, they are marking the 'temperature' of inodes based on access patterns.
"Sometimes, I think Trent just needs a cup of hot chocolate and a blankie." -Tori Amos on Nine Inch Nails
Dear ColMustard,
I was wondering why my Ford Escort doesn't get good pickup when I've got it packed with bricks. It goes fine when it's just me and the seats, but once I pile those bricks in it's so laggy! Do you think I should put brighter headlights in, or should I change the blinker fluid?
"Sometimes, I think Trent just needs a cup of hot chocolate and a blankie." -Tori Amos on Nine Inch Nails
Actually, if you read some of the articles about Microsoft's preview of Longhorn you'll see that they're developing a new filesystem that not only incorporates metadata but takes it to the level of a relational database. Expect to see many articles on how metadata is the best innovation to come from Microsoft since Windows 95.
-- thinkyhead software and media
I wonder how that interacts with the "secure" delete. Does it seeks out previous copies of the file and securely delete them too? That would be quite a feat.
(Also, has anyone confirmed that the code snippet is actually executed?)
eet MOR cok k? 3 WWW.stupidfag.COM
I use to be indecisive, but now I'm not so sure.