[comp.sys.mac.system] Bad Free Block Count?

bochner@lange.harvard.EDU (Harry Bochner) (09/27/90)

After a crash last night, my hard disk came back up saying it had 2.3 Meg free,
down from 3.5 Meg before the crash :-(
A manual check didn't reveal where the space had gone, so I tried ShowSizes,
a (fairly old) utility showing how much space is being used by each folder.
IT tells there's 3.5 Meg free !! Hmmm ...

My guess is that the disk is corrupted in one (or more) of the following ways:
1) bad free block count in the Volume header.
2) garbage in the block allocation bit map.
3) corrupted Extents B-tree.

My questions:
1) Are any of these things checked by the disk check the system does when it
   comes back up after a crash? What does it do, actually?
2) What utilities are available for tracking down and fixing problems
like this?
   Does anything allow disk surgery on HFS volumes the way FEDIT did for MFS?
3) How do I get my 1.2 Meg back, short of reinitializing the disk?

Harry Bochner
bochner@das.harvard.edu

gandalf@apple.com (Martin Gannholm) (09/27/90)

In article <4266@husc6.harvard.edu> bochner@lange.harvard.EDU (Harry 
Bochner) writes:
> After a crash last night, my hard disk came back up saying it had 2.3 
Meg free,
> down from 3.5 Meg before the crash :-(

He continues to say:
> 2) What utilities are available for tracking down and fixing problems
> like this?
> 3) How do I get my 1.2 Meg back, short of reinitializing the disk?

The answer is: Run Disk First Aid -- you know the ugly, seemingly-worth-
less utility that is shipped on the Utilities 1 disk of System Software. 
Despite its lack of user interface or even common command-key equivalents 
it does a good job of finding and fixing many different problems with the 
directory and other structures on your hard disk.

DFA won't tell you much of what it found, unless you hit cmd-S, and will 
basically just allow you to repair problems that it finds.

I usually run DFA at least once a day if I've crashed at all, and 10% of 
the time it fixes a problem. If you never run DFA or something like Norton 
Disk Doctor (no endorsement intended although I personally like what I've 
seen so far) I'd suggest you do it right away -- chances are you'll have
some error that could bite you later.

If you leave these problems too long and they stack up, you're destined to 
get weird problems with "folders from hell" and other strange behaviour 
with files/folders. If DFA says "Unable to verify status of disk", I'd say 
that such problems have accumulated past the point of simple repair and 
your only bet is to reformat your disk.

A side note to NDD, mentioned above: it seems as though there are some 
problems which NDD can detect but not fix -- and in that one case that 
I saw DFA was able to fix it instead!

Since I started running DFA regularly after crashes, I haven't had _any_ 
problems with my HD's...could be pure luck, I guess, but my data is too 
valuable (and backups too infrequent) to start gambling.

Martin Gannholm
Apple Computer

Exclaimer!!! I typed this myself = I speak for myself...

jimb@silvlis.com (Jim Budler) (09/29/90)

In article <4266@husc6.harvard.edu> bochner@lange.harvard.EDU (Harry Bochner) writes:
>After a crash last night, my hard disk came back up saying it had 2.3 Meg free,
>down from 3.5 Meg before the crash :-(
Ugh!
>A manual check didn't reveal where the space had gone, so I tried ShowSizes,
>a (fairly old) utility showing how much space is being used by each folder.
>IT tells there's 3.5 Meg free !! Hmmm ...
It's probably totalling all the files, and probably correct.
>
>My guess is that the disk is corrupted in one (or more) of the following ways:
>1) bad free block count in the Volume header.
>2) garbage in the block allocation bit map.
>3) corrupted Extents B-tree.

 
You're probably correct.
 
There are several utilities that are supposed to correct such things.

First you might try Disk First Aid. You should have a copy, it
comes with the System Software from Apple.

Of others:
I can only speak for Norton Utilities for the Macintosh.
I have a copy and love it. It checks and repairs (or attempts to)
this type of problem. I've used it on several machines, and have
found problems, been informed of the exact nature of the problem,
and prompted a request to repair.

The only reason I placed the caveat above is because I have one machine
on which it crashes during the attempt to repair. No fear, after the crash
the machine comes up with the problem still there, but no additional
damage done.

On that machine I am going to have to do a backup, format and restore.
I haven't had the time, the user is experiencing no problems.

jim

--
Jim Budler          jimb@silvlis.com       +1.408.991.6115
Silvar-Lisco, Inc. 703 E. Evelyn Ave. Sunnyvale, Ca. 94086

urlichs@smurf.sub.org (Matthias Urlichs) (09/29/90)

(DFA == Disk First Aid, NDD == Norton Disk Doctor)

In comp.sys.mac.system, article <10438@goofy.Apple.COM>,
  gandalf@apple.com (Martin Gannholm) writes:
< > 3) How do I get my 1.2 Meg back, short of reinitializing the disk?
< 
< I usually run DFA at least once a day if I've crashed at all, and 10% of 
< the time it fixes a problem. If you never run DFA or something like Norton 
< Disk Doctor (no endorsement intended although I personally like what I've 
< seen so far) I'd suggest you do it right away -- chances are you'll have
< some error that could bite you later.
< 
Be aware that if you ever used System 7.0 alpha/beta/anything on that disk,
chances are that its catalog tree contains records which neither DFA nor NDD
understand.
The catalog tree is an HFS data structure which features "tagged" data types,
so it's rather easy to add new features without breaking anything. Anything
but disk repair tools, that is -- System 7.0 does it, and so do some
copy-protected programs which have to be installed on your hard disk with a
special program.  :-(

In the case of System 7.0, DFA will say "can't verify", NDD will say
"Incompatible with System 7, call hotline at XXX-XXX-XXXX".

I don't know about DFA, but NDD can be patched to treat these records as
"unknown", and to continue.

I did that patch last week, after not checking the disk prior to optimizing
it (with Norton's optimizer). The reason for this is that the optimizer runs
under A/UX, while NDD currently doesn't (it assumes too much about SCSI
and/or the floppy disk driver). Result: Disk badly mangled, unfixable with
anything but NDD.

The patch involves hacking an in-code jump table entry. If there's demand for
it, I'll recreate it next week. (Having been in a hurry, I didn't save the
information on paper. :-( )

< If you leave these problems too long and they stack up, you're destined to 
< get weird problems with "folders from hell" and other strange behaviour 
< with files/folders. If DFA says "Unable to verify status of disk", I'd say 
< that such problems have accumulated past the point of simple repair and 
< your only bet is to reformat your disk.
< 
Or some developer has tried System 7.0 on it...
"Past repair" is not true, BTW. Norton's DD is far better at recovering from
weird problems than DFA.

< A side note to NDD, mentioned above: it seems as though there are some 
< problems which NDD can detect but not fix -- and in that one case that 
< I saw DFA was able to fix it instead!
< 
Or vice versa -- it's a good idea to have two tools; they complement each
other in that particular area. The primary difference is, of course, that NDD
is a complete solution while DFA is a specific, and free, tool.
Secondary is the fact that DFA just gives up when it can't fix your data
structures without destroying anything, but NDD tries to patch up your data
structures no matter what. I loke Norton's approach better because if the
alternative is to unconditionally initialize a disk, you don't care much if
some things break while trying a recovery.
Another point is that NDD is very good at explaining to you what it's about
to do, what the consequences of doing it are, and whether you want it to go
ahead. DFA doesn't say anything at all unless the user presses Command-D
(very undocumented) to bring up the logging window, which isn't exactly
verbose either.

NB: The most common problem after a crash is that some blocks are neither on
the free list nor associated with any file. This is a benign problem; both
DFA and NDD will repair these.
Bad file counts (an empty folder contains 1 item :-( ) seem to be somewhat
more common. NDD will fix these, DFA won't.
Worst are, of course, mangled HFS data structures (which often prevent the
disk from being mountable at all), and blocks belonging to the free list
_and_ a file. NDD seems to have some problems with these, but usually it can
get your data back. (It has some difficulties when disk blocks belong to more
than one file. This is somewhat understandable.  :-( )

NBNB: The origin of the above list is my development of SingleShare. In its
early stages, it averaged ten crashes per day and one complete disk restore
per week.
I didn't have NDD at first, and what else do you do if DFA won't help you?

-- 
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de     /(o\
Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(0700-2330)   \o)/

wilkins@jarthur.Claremont.EDU (Mark Wilkins) (09/30/90)

  By the way, if you are using System 7, there's an alpha version of the
Disk First Aid which will be shipped with System 7 on the Big Bang CD.

  What you have to do is make Utilities disks from the System 7 installer
disk images.  DFA is on there, and it's been updated for System 7.

-- Mark Wilkins
-- 
*******     "Freedom is a road seldom traveled by the multitude!"    **********
*-----------------------------------------------------------------------------*
*  Mark R. Wilkins   wilkins@jarthur.claremont.edu   {uunet}!jarthur!wilkins  *
******  MARK.WILKINS on AppleLink  ******   MWilkins on America Online   ******

kent@circus.camex.com (Kent Borg) (10/01/90)

In article <8752@jarthur.Claremont.EDU> wilkins@jarthur.Claremont.EDU (Mark Wilkins) writes:
>DFA [on the 7.0a9 CD has] been updated for System 7.

Thanks for the tip.  This version of Disk First Aid crunches away for
awhile before telling me that it is unable to verify the disk.  Does
this mean that my disk is in deep do-do?


>-- Mark Wilkins

--
Kent Borg                            internet: kent@camex.com   AOL: kent borg
                                            H:(617) 776-6899  W:(617) 426-3577
"The prospect of their mass excites astrophysicists, who are always on the
 lookout for ways to make the universe heavier"   -- The Economist, 9-22-90