
|
Looking for the GuiltyA blog.
|
|
lupo's last comments:
1
2
3
4
5
florin's last comments:
1
2
3
4
5
|
How NOT to defrag a MacOS X partitionauthor: www-data As most of you who know me probably already know, here's how my computer is set up: 35 GB for a MacOS X partition, 25GB for a Linux partition, roughly 15 GB for an exchange data partition. Well... that changed. I just trashed MacOS X trying to defrag the partition. The MacOS X (non)fragmentation myth
"But HFS+ doesn't need any defrag, MacOS X does everything
automagically" is bullshit. HFS+ partitions do fragment, period.
What Mac OS X does is reducing the file fragmentation, if
(a) a file is less than 20GB in size, (b) the system has been up for
more than 3 min and (c) the file is accessed. Else, it does not. Oh,
and MacOS X does not do anything about disk fragmentation.
BTW, the difference between the one and the other is that
when a file is fragmented, then the file is scattered all around the
disk, instead of being in one continuous piece. When a disk is
fragmented, then the disk more or less like a piece of swiss cheese:
there are files all over the disk. Even if every one of the individual
files may be defragmented, i.e. in one piece each, they are still
badly placed. The problem is then, that although your But back on topic: MacOS X disks not needing defragmentation is a myth. The true core of the myth is that, due to the automagical semi-defragmentation of MacOS X, it takes quite a while until the fragmentation of the disk becomes an issue -- much longer than in the case of a FAT or NTFS system. But sooner or later, even on a HFS+ partition, fragmentation will become an issue. This is mostly the case when the drive is filled up to 70-80%, as lots of people on the net reported. (Apple's answer to that is "buy a larger HDD" :). Or, as in my case, if you wish to shrink your MacOS X partition to create some more space, a fragmented disk can also effectively veto that. The fragmentation issueI (used to) have a MacBook with 4 partitions:
The 4th partition I typically mounted to The partition table is a GPT/MBR hybrid (google that one up for yourself, I'm not going to explain what it means right now...). Few weeks ago I stumbled upon a blog entry stating that a GPT/MBR hybrid with more than 4 primary partitions was possible. And: yes, it is :-) The whole point of the "MBR" part in "GPT/MBR hybrid" is for the BIOS-emulation-based boot loader of whatever OS you're trying to boot (Linux+Grub, in my case) to be able to actually load the OS from that partition. But this boils down to: you can have as many GPT partitions starting from 5 on as you wish to... you just cannot boot any BIOS-based OS from them :-) But since Linux starting with more recent versions (2.6.28 for sure, 2.6.26 maybe) can read GPT partition tables directly, I can use the whole beauty of the GPT table at will to store data on partitions beyond the magic limit of 4. And all I wanted was a swap partition for linux. So, here was the deal:
The command diskutil resizeVolume disk0s2 30B [Swap swap 5G]
should have done the trick. But instead it stopped with an error: "No space left on device". And that was it: the point where things started to turn for the worst. It's like one of those moments, where you know you should stop whatever you're doing, or else... Well, I didn't, so here's the "or else": I looked up the error for a while, and leadned a lot about MacOS X and HFS+ fragmentation. Ultimately, I found two tools: iDefrag and ShowVolumeFragmentation. The former is a commercial (as in "costs money" :-) defragmentation tool, the latter is a shareware/freeware tool based on hfsdebug. From the ShowVolumeFragmentation tool I learned that from approximately ~7 GB of free space, more than 5 were in pieces smaller than 10 MB, and about 40% of my complete free space was in chunks smaller than 1 MB. I had no piece of disk larger than 100 MB... Well, Apple fanboys, how's that for an "MacOS X automagically defrags your disk"? (Why're there so many clueless morons with an oppinion out on the streets nowadays?... )
So, despite the existence of a perfectly working (albeit somewhat expensive)
defragmentation tool for HFS+, I did what any geek with a root
password would do when defragmentation
time has come: booted from external disk, Biiiig mistake. For whatever reason (I don't know and I don't really care to know -- I assume it has something to do with funny meta-data of MacOS X), after re-populating the newly formatted partition, the OS didn't come up any more. It hung at trying to boot some basic tool (mDNS* stuff), and then eventually gave me a paniced system root shell without a login name -- just enough to for me to type "reboot". So, folks, this is how not to defrag a MacOS X HFS+ partition. Instead, go buy iDefrag. As about me... Sticking with linux
The good part about this story is the timing: prior to trashing my MacOS
X install, I had just finished installing my
Linux on the 'mac in such a way that everything worked practically out of the
box: WiFi with WPA2 encryption (with the ath9k driver of the 2.6.28 kernel,
using the knetworkmanager), accelerated
graphics (works with debian lenny out of the box), suspend to RAM (need
to Well, eventually I booted the Linux environment using the MacBook builtin boot menu (works great without rEFIt, too ;). I partitioned the disk as I initially planed to.
[NOTE on partitioning: I used So, now I'm back to linux. To be honest: it feels like home again :) I never was really far away anyway, I used almost exclusively free software tools like Gimp, xpdf, gv, Inkscape in MacOS X anyway. But a native linux is just... the real thing ;) And guess what: linux's UI is
faster/snappier than MacOS X by a noticeable amount, I'd say roughly
3-5%.
2009-02-08 14:42 | www-data Older entries |