Re: Map a disk LBA to filename?

Carsten Aulbert
2008-10-27T14:10:44Z

Hi Michal

Michal Soltys wrote:
>
> Wouldn't something like (under xfs_db) :
>
> getblock -b #block -n
> ncheck -i #inode
>
> where required #inode is reported by getblock
>
> do the thing ?
>

Sounds nice, but my (ancient? 2.8.11) version of xfs_db does not know
getblock (only blockget) since that also matches the command line and
the usage looks about to be right, I'm currently trying that one, e.g.

smartctl reports a bad LBA at 36922326. fdisk tells me the partition
starts at 31069773, hence the block under question is 5852553.

xfs_info tells be a bsize of 4096 which I take as the block size, thus
the xfs block to look at should be 731569, right?

xfs_db> blockget -b 731569 -n
setting block 0/731569 to free1
setting block 0/731569 to free2
xfs_db>

hmm, no inode number. Does that mean this block is not used by any file
currently - which might be perfectly fine since this partition is only
31% full.

Everything right so far?

Cheers

Carsten