Corrupt File System (was Re: Unmountable disk partitions)
Barry Shein
bzs at world.std.com
Thu Nov 22 16:31:01 AEST 1990
? Is there any way I could have "repaired" the disk using
? some kind of file system binary editor (fsdb?)?
Depends on what was really damaged. It's not hard to write a little
program in C which whacks the super-block (see fs.h under your system
include directories, probably sys/ or ufs/). It's just a struct.
First thing to do is look for backup super-blocks (I think that's the
-b option to fsck, try 32, "fsck -b 32" or something like that, rtfm.)
The next thing to do, if that doesn't work, is print the superblock
out and see if it's remotely salvageable, and if so, write a program
which fixes values and writes it all back. Another useful exercise is
printing out the backup superblocks and see if they're in better shape.
Even a pretty bad guess at what should be in a superblock might let
fsck do its magic as it will verify things like inodes and blocks
free, so most of that can be wrong and fsck will recover (fortunately,
some of that is the hardest to get right since it changes second to
second.)
? Where would I find info on where info is stored on
? the disk and in what format?
The system include files, it's not that bad really, in particular,
study the various macros, they can save you from having to understand
a lot of the particulars as they do things like translate what you got
into what you want (e.g. an inode number into a block the inode info
resides on.)
Anyhow, it will make a better person of you!
What I recommend heartily is playing with some programs for snooping
around the disk data structures when you *don't* have an emergency on
your hands. They'll come in handy later if you do have a problem.
Maybe there are some PD programs about to start with (anyone?)
--
-Barry Shein
Software Tool & Die | {xylogics,uunet}!world!bzs | bzs at world.std.com
Purveyors to the Trade | Voice: 617-739-0202 | Login: 617-739-WRLD
More information about the Comp.unix.internals
mailing list