Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!decwrl!world!bzs From: bzs@world.std.com (Barry Shein) Newsgroups: comp.unix.internals Subject: Re: Corrupt File System (was Re: Unmountable disk partitions) Message-ID: Date: 22 Nov 90 05:31:01 GMT References: <1384@adds.newyork.NCR.COM> <1990Nov15.204556.12303@scuzzy.in-berlin.de> <1470@ul-cs.ulowell.edu> Sender: bzs@world.std.com (Barry Shein) Followup-To: comp.unix.internals Distribution: na Organization: The World Lines: 43 In-Reply-To: jgroves@hawk.ulowell.edu's message of 19 Nov 90 03:04:03 GMT ? 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@world.std.com Purveyors to the Trade | Voice: 617-739-0202 | Login: 617-739-WRLD