[clue-tech] filesystem: which sector is file x on?

Jim Ockers ockers at ockers.net
Wed Mar 7 18:59:39 MST 2007


Hi,

So someone asked me today how to tell which file is on a given
sector of a disk.  For instance if the kernel is throwing bad 
sector errors with sector number 1234567, how could we tell what
file in a filesystem is likely to be affected.

I know there are lots of things to consider so let's assume the
following:

- IDE hard drive
- Standard IDE controller
- Generic IDE driver
- ext2 filesystem, 4k blocksize

So my guess is that block device drivers make all block devices 
appear be n consecutive blocks, all error free.

I think the drive does all the sector stuff within the drive and
there is no way to tell what sector a particular block (or file)
is on.  I told him this might be like trying to get a tape drive
to tell you how many inches of tape were spooled on each spool
for a paritcular bunch of bits on the tape.

But maybe someone out there has some idea how?  Also maybe SCSI is
different from IDE?

This blog post states: http://prefetch.net/blog/index.php/category/linux-storage/

"all modern disk drive controllers contain logic to remap faulty sectors when they are detected"

So maybe the info is in the controller?  Does that mean the drive
electronics?

Thanks,
Jim

-- 
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: please see http://www.ockers.net/



More information about the clue-tech mailing list