[net.unix-wizards] Correlation of block # to filename

kdq@pthya.UUCP ( Kip Quackenbush) (06/26/84)

<<eat me>>

Is there a method of determining a file's block # under
SYS V?

Problem:

	Took many device errors on a particular block.
	Would like to find out the file(s) that reside
	in that block. My guess is that once you know the
	filename, you can copy it, then move the original
	to outer space, and bingo, the potential read of the
	bad block will not happen.


Solution?.....................



-- 
	Kip Quackenbush

	pthya!kdq
	{ihnp4,ucbvax,cbosgd,decwrl,amd70,fortune,zehntel}!dual!pthya!kdq
	Pacific Bell, San Francisco, California

dave@uwvax.ARPA (06/29/84)

There should be holdovers on Sys V from version 7, namely
icheck and ncheck (names may have changed -- its been a while).
Method:

icheck -b <blocknumbers> <filesystem>
	this gets you the inode containing the specified block(s)

ncheck -i <i-numbers> <filesystem>
	this gets you the filename(s)

They are both described in the manual: icheck(8), ncheck(8).
-- 
Dave Cohrs @ wisconsin
...!{allegra,heurikon,ihnp4,seismo,sfwin,ucbvax,uwm-evax}!uwvax!dave
dave@wisc-rsch.arpa

ron@BRL-TGR.ARPA (06/29/84)

From:      Ron Natalie <ron@BRL-TGR.ARPA>

We used to do this with icheck -b (tell me what inodes this block exists in)
and ncheck -i (give me the name of this inode).  Unfortunately icheck was
replaced by fsck and fsck doesn't seem to have this feature.

-Ron

fair@dual.UUCP (Erik E. Fair) (07/04/84)

What you need to do, Kip, is get the logical block number first.
If all you have is the physical block number, you have to figure out
which filesystem it's part of (i.e. which logical device). Once you
do that you can do this:

	% icheck -b bn# bn# bn# ... /dev/rhp0a
	inode xxxx

	% ncheck -i xxxx /dev/rhp0a
	xxxxx /foo/bar/bletch

Icheck will waltz through the inodes looking for the inodes which claim
your bad block. When you have the inode number (or numbers in the 
unfortunate case of dups), you can get the names which reference those
inodes from ncheck, which waltzes down the directories to this end.
Clear?

	Erik E. Fair	ucbvax!fair	fair@ucb-arpa.ARPA

	dual!fair@Berkeley.ARPA
	{ihnp4,ucbvax,cbosgd,decwrl,amd70,fortune,zehntel}!dual!fair
	Dual Systems Corporation, Berkeley, California

jm@wlbr.UUCP (07/09/84)

Unfortunately, icheck(1M) is not distributed with System V.
However, ncheck is, and may easily be hacked to yield a
superior substitue.

Jim Macropol
{ihnp4,scgvaxd,trwrb,vortex}!wlbr!jm