SUMMARY: Mapping Disk Block Numbers to Filenames

From: Harvey Wamboldt (
Date: Mon Mar 08 1999 - 14:17:29 CST

Original question is at the bottom.

After an extensive search I still don't have an answer to this one.
If you know how to locate a file using a specific SCSI block address,
please share.

Possibly Sun regards this information to be part of their crown
jewels. If so then I wish Sun would offer a utility equivalent to the
old icheck ... after all Linux offers icheck ;-)

(1) I did receive a suggestion that once I had the inode for the bad
block then the "find" program from findutils
<> will search for the pathname that
corresponds to that inode.

(2) I received a comment that there is no back pointer, so this would
require a search of the entire partition, which I knew, and that fsck
might (or might not) locate the error.

(3) I received a comment suggesting using tar|cpio|ufsdump to
/dev/null to see where the command fails.

But I'm left very disappointed. I had this capability before under
SunOS and now I've lost it. I can't even find an API which lets me
write my own disk scanner to search the inodes to determine which
contains a pointer to the bad block.

Thanx goes to:

  Reichert, Alan <>
  Nick Hindley <>
  Robert Perez <>

---------- Original message ----------
Date: Wed, 3 Mar 1999 20:27:14 -0400 (AST)
From: Harvey Wamboldt <>
To: Sun Managers Mailing List <>
Subject: Mapping Disk Block Numbers to Filenames

OS: Solaris 2.5 and up.

Q. How do I locate a file given a block number?

For example:

    Feb 15 20:06:02 bluemax unix: WARNING:
      /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@0,0 (sd0):
      Error for Command: read
      Error Level: Retryable
      Requested Block: 32304
      Error Block: 32313
      Vendor: SEAGATE
      Serial Number: 9804C75914
      Sense Key: Media Error
      ASC: 0x11 (unrecovered read error),
      ASCQ: 0x0, FRU: 0xea

The bad block on the disk is 32313. I can use the block number to
determine the partition by looking at the partition table, but I can't
seem to find any way to determine what file uses that block.

I know I could back up the partition and use format to run the analyze
command, and that probably would be a good idea. But to quickly get a
machine running again I want to simply use format and run the repair
command to put the bad block on the defect list, then deal with the
broken file.

Of course if the bad block is an i-node, or part of the free list,
then things start to get ugly ... but in the simple case of a data
block I should be able to quickly fix the problem -- if only I could
figure out which file uses the block.



Harvey M Wamboldt ^ E-Mail:
MDA Inc 1000 Windmill Rd. Suite 60 ^ Fax: (902)468-2278
Dartmouth NS, B3B 1L7, Canada ^ Phone: (902)481-3531

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:16 CDT