Thoughtful, detailed coverage of the Mac, iPhone, and iPad, plus the TidBITS Content Network for Apple consultants.

HFS Infestation

I don't know if there is a Pulitzer Prize in computer journalism, but if there were I'd nominate Ric Ford of MacWEEK for this year. Fighting with problems on his Macs, Ric tracked down a subtle and confusing bug that has lurked for years within HFS, the Hierarchical Filing System. Others had noticed the bug, but as near as I can tell, until Ric came along, no one figured out what was happening clearly enough and informed Apple at an official-enough level for the bug to be recorded, tracked, and exterminated.

I haven't personally seen the bug, but its symptoms are that when your Mac crashes, it flashes the question mark rather than rebooting if the affected disk is a boot disk. If the affected disk is not a boot disk, the Finder won't think it's a Macintosh disk and will ask you if you want to Eject or Initialize. Needless to say, this is quite noticeable, not to mention irritating beyond belief.

Here's what's happening. When the Mac starts up, it sets a "dirty" flag in the volume information block of each volume. If you shutdown gracefully, the Mac clears that flag and all works fine. If you crash, the Mac sees the dirty flag on the subsequent boot, and checks the disk's catalog and extents files for damage (it usually finds not damage). Under specific circumstances, the Mac blows that check and thinks the disk is indeed damaged, when in fact all that has happened is that the Mac made an incorrect calculation.

The only fix is to boot with an emergency floppy from Central Point's MacTools, Norton Utilities, or Fifth Generation's Public Utilities and then have the disk recovery program remount the disk, clearing that improperly set flag. Note that these programs will not report any problems in the process because they don't know about the bug; they just know how to clear that dirty flag.

I could describe the specific circumstances necessary to release the bug, but there's no point. Instead, let me point you to a free program that Central Point Software's Dave Camp created on Ric's suggestion. Called Disk Bug Checker, the program can tell you how likely it is that a hard drive will suffer from the bug. Disk Bug Checker, which is available on most online services, including sumex as </util/disk-bug-checker-11.hqx>, checks the size of your catalog and extents files along with your partition's fragmentation level and then tells how susceptible that disk is to the bug. Small partitions are seldom, if ever, affected (which may account for the life-span of this particular bug), and the Disk Bug Checker claimed I wouldn't be susceptible until I had 34,817 fragments. That's pretty unlikely.

The best way to avoid the bug in the future if you're experiencing it is to back up your disk (carefully!) and use the Finder's Erase Disk command (from the Special menu) on that disk, restoring your files when you're done. The Finder will rebuild the catalog and extents files, and in the process may change them slightly from your original formatting program. That may eliminate the problem in some cases, especially for volumes around 85 MB to 95 MB, when the allocation block size is 1.5K. If using Erase Disk doesn't help, reformat your hard disk with a different formatting program or with a slightly different partition size, say plus or minus 100K. That will change the size of the catalog and extents files, which will in turn change your susceptibility to the bug. Apple knows about the bug now, so we can hope that they will fix it for good in the future.

Information from:
Ric Ford, MacWEEK -- 72511.44@compuserve.com

Related articles:
MacWEEK -- 15-Feb-92, Vol. 7, #7, pg. 74
MacWEEK -- 08-Mar-92, Vol. 7, #10, pg. 58


READERS LIKE YOU! Support TidBITS by becoming a member today!
Check out the perks at <http://tidbits.com/member_benefits.html>
Special thanks to Morton Johnson, Alfred Hauk, Chris Hart, and Frank
Demmler for their generous support!