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

David L. Anselmi anselmi at anselmi.us
Wed Mar 7 19:46:08 MST 2007


Jim Ockers wrote:
> 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.
[...]
> 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"

It also says "We also used the ext3 file system debugger to see if a 
file was using the block".

The debugger is debugfs.  So:

debugfs: icheck _block_

tells you which inode owns the bad block.  Then:

debugfs: ncheck _inode_

tells you the path to that inode (relative to the fs root).

If you use something besides ext2/3 on a physical partition you may need 
other tools.

HTH,
Dave




More information about the clue-tech mailing list