[comp.unix.i386] Can I derive an inode # from an absolute sector #?

steve@hite386.UUCP (Steve Hite) (02/22/90)

    I have 386/ix v2.0.2.  Recently, I had gotten an absolute sector read
error report.  I have called Interactive tech support about this in the past
and they couldn't tell me explicitly how to find out the inode # if there
is a disk error giving the absolute sector # as the problem spot on the hard
disk.  Can it be done?  How?   The style of error I got was this:

 ***Device Error: Sector not found
 ***Controller 0 Disk Drive 0 Absolute Sector #59364 ***
 
 Page 139 of the OS Guide gives this reason for the error:

   'You attempted to access a sector that does not exist'

    I assure you that this sector is alive and well on on my Unix partition. 
I do have a Perstor card that is working fine (and giving me 130 megs off
of a 70 meg drive).  I know, "but Interactive doesn't support the Perstor
card..."...well, my Perstor doesn't know that :-).  What I think is happening
is that I'm getting a bad sector and the bad sector relocation scheme that
AT&T uses can't handle the auto relocation because it's a *Perstor card*
(ah, that's what they mean by not supporting it :-)).  Currently, I can just
add the absolute sector to the bad blocks list and then everything will work
fine...but I don't know what file got kablooied. 

    What I was trying to do is get the inode # and then use 'find' to tell me 
what file (if any) was currently using that inode...voila, I know what file 
I'll have to replace after adding the sector to the bad blocks table.

    I think fsdb might work, but with a couple of man pages as my only guide
I'm not up for corrupting my file system. :-)

    Many thanks for your help!   

-------------------------------------
Steve Hite
...gatech!uflorida!unf7!hite386!steve

bruner@uicsrd.csrd.uiuc.edu (John Bruner) (02/22/90)

In article <24@hite386.UUCP> steve@hite386.UUCP (Steve Hite) writes:
>    I have 386/ix v2.0.2.  Recently, I had gotten an absolute sector read
>error report.  I have called Interactive tech support about this in the past
>and they couldn't tell me explicitly how to find out the inode # if there
>is a disk error giving the absolute sector # as the problem spot on the hard
>disk.  Can it be done?  How? ...

The old filesystem consistency program "icheck" will do what you want.
Vendors often provide icheck/dcheck/ncheck with their ports (particularly
V7-derived ones like BSD, SunOS, etc.)  If Interactive supplied it, you
can get the inode number with the command:

	icheck -b blockno device

where "blockno" is the block number within device "device".  Use the
raw device if possible.

You can get the filenames which reference this inode (the (hard) links
to the file) with "ncheck":

	ncheck -i inode device

Again, use the raw device and be prepared to wait a while if the
filesystem is large.

Both of these commands are safe to use while the filesystem is mounted,
although given the device errors I probably would do it in single-user
mode with the filesystem unmounted.
--
John Bruner	Center for Supercomputing R&D, University of Illinois
	bruner@uicsrd.csrd.uiuc.edu	(217) 244-4476