Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uunet!mtxinu!ed From: ed@mtxinu.COM (Ed Gould) Newsgroups: comp.unix.sysv386 Subject: Re: Mapping abs sector numbers to files Message-ID: <1991Jun8.034000.559@mtxinu.COM> Date: 8 Jun 91 03:40:00 GMT References: <767@dumbcat.sf.ca.us> <1991Jun7.132959.8512@sci34hub.sci.com> Reply-To: ed@mtxinu.COM (Ed Gould) Organization: mt Xinu, Berkeley Lines: 29 > I haven't found this in TFM yet -- perhaps the net can help. Given > an error message that says something like "SCSI absolute sector > 1234 on drive 1 is bad" how can I map this sector number to a > file/directory/(inode!). The tool to do this is icheck, if it exists in your version of Unix. However, it's a three-step process. First, you need to determine the relative sector number in the filesystem affected. If the driver is well written, it will report both absolute and relative sector numbers. If not, you'll have to subtract the starting sector number of the filesystem partition from the absolute sector number. (Be careful - partition offsets are often specified in cylinders, not sectors.) Second, the sector number must be converted into a filesystem block number; some drivers will report it as well. This is a simple matter of division, dividing the sector number by the blocking factor, being careful to round up properly. The "blocking factor" is the number of sectors per filesystem block: If you have a 1024-byte-block filesystem and 512-byte sectors, the factor is 2. This filesystem block number can be fed to icheck, which will report the inode number of the file containing the block. If you want the name(s) of that file, then feed the inumber to ncheck. -- Ed Gould No longer formally affiliated with, ed@mtxinu.COM and certainly not speaking for, mt Xinu. "I'll fight them as a woman, not a lady. I'll fight them as an engineer."