Re: Map a disk LBA to filename?

Dave Chinner
2008-10-27T11:50:01Z

On Mon, Oct 27, 2008 at 12:20:27PM +0100, Carsten Aulbert wrote:
> Hi all,
>
> I have not found it in the archive, thus my question to all:
>
> Along the lines of this doc
> http://smartmontools.sourceforge.net/BadBlockHowTo.txt
>
> I would like to find out if that's also possible for XFS, i.e. I have a
> disk which tells me, that there is a problem with LBA x and I identify
> that this block is within the range of a largish XFS file system.
>
> Now, I would like to identify the file which is possibly broken and
> repair it if I can without taking the machine down for hours running the
> manufacturers DOS tools. With simple ext[23] this is possible, but I'm
> not getting anywhere with reading xfs_db and xfs_ncheck man pages to get
> there.
>
> Anyone here with a brief recipe I can get along with?

Use xfs_bmap to find the location on disk of the extents in each
file. Recurse over the filesystem until you find the file that owns
the block that went bad.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com