jgroves@hawk.ulowell.edu (Jonathan Groves) (11/19/90)
In article <1990Nov15.204556.12303@scuzzy.in-berlin.de> src@scuzzy.in-berlin.de (Heiko Blume) writes: [Deleted stuff on Unmountable disk partitions] > i'll be happy to send you a little superblock editor (:-) > so you can change the filesystem type magic number > or whatever you like to make mount fail. I may need such an editor. Today one of our file servers crashed [Ultrix] and when it tried to come back up, it failed during the fsck. After an interactive session with fsck, the disk still failed, and another interactive fsck leaves me with this: (Comments from M.K.McKusick's FSCK document (1983), included with Ultrix Supplementary Docs. Volume 3) ** /dev/ra0f ** Last Mounted on /usr/users ** Phase 1 - Check Blocks and Sizes CG 0: BAD MAGIC NUMBER 1763713056 BAD I=28 [Several of these] 1601463663 BAD I=28 EXCESSIVE BAD BLKS I=28 CONTINUE? y # CG c: BAD MAGIC NUMBER # The magic number of cylinder group c is wrong. # This usually indicates that the cylinder group maps have # been destroyed. When running manually the cylinder group # is marked as needing to be reconstructed. ? How is the map reconstructed, and at what phase of fsck? ? Obviously after where it dies on me. ? Is this happening because I "corrected" part of the ? file system that I shouldn't have? ** Phase 2 - Check Pathnames ROOT INODE UNALLOCATED. TERMINATING. # ROOT INODE UNALLOCATED. TERMINATING. # The root node (usually inode number 2) has no allocate mode bits. # This should never happen. The program will terminate. ? So what do I do? ? I newfs/mkfs and restore from backups... ? Is there any way I could have "repaired" the disk using ? some kind of file system binary editor (fsdb?)? ? Where would I find such an editor? ? Where would I find info on where info is stored on ? the disk and in what format? In several places the document concludes the solution to be "See a guru." But there's no guru index. :-) I hope someone out there can answer these questions... +-+n Jonathan Groves Internet: jgroves@hawk.ulowell.edu | |U Snail: 1 Univ. Ave. BOX 487 UUCP: ...!bbn!ulowell!hawk!jgroves | \_/+ Dungeon: (508)452-8586 [Voice] +----+ ULowell 1 University Avenue Lowell, MA 01854 (508)934-4000
bzs@world.std.com (Barry Shein) (11/22/90)
? 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