On Sat, Aug 20, 2005 at 11:33:41AM +0200, Markus Meyer wrote:
> Hi folks,
>
> My Smartmontools reported a defect block on one of my disks with an XFS
> on them. So I wanted to follow the Badblocks-Howto [1] to find the
> corresponding Inode and the file that I can "repair" the block and
> restore the file. But I have no idea how to accomplish this on XFS.
> Is there anyone around who can help me? Well there aren't that many docs
> around and the man pages are not a big help (or maybe I'm just blind).
From a quick read of the howto you fwd'd (thanks, interesting), this is
how that same information can be extracted for XFS - in this case I've
started from filesystem block number 98319..
# xfs_db /dev/sdb5
xfs_db> blockget -b 98319
setting block 3/15 to symlink
setting inode to 393291 for block 3/15
inode 393291 block 98319 at offset 0
xfs_db> blockget -i 393291
already have block usage information
xfs_db> blockfree
xfs_db> blockget -i 393291
inode 393291 add link, now 1
inode 393291 add link, now 2
inode 393291 mode 0120777 fmt extents afmt extents nex 1 anex 0 nblk 1 sz 319
inode 393291 nlink 2 not dir
inode 393291 extent [0,98319,1,0]
setting inode to 393291 for block 3/15
xfs_db> blockfree
xfs_db> blockget -n
xfs_db> ncheck -i 393291
393291 pd/d8/d15/d1a/l4a
xfs_db>
Oh, and initially you'll need to get from disk address (512 bytes) to
a filesystem block number - use the convert command:
xfs_db> convert fsb 98319 daddr
0x19020 (102432)
xfs_db> convert daddr 102432 fsb
0x1800f (98319)
cheers.
--
Nathan
|