On Fri, 21 Sep 2018 14:34:06 +1000 Cameron Simpson <cs(a)cskk.id.au> wrote:
On 20Sep2018 21:31, Ranjan Maitra <maitra(a)email.com> wrote:
>On Fri, 21 Sep 2018 12:12:26 +1000 Cameron Simpson <cs(a)cskk.id.au> wrote:
>> On 20Sep2018 19:06, Ranjan Maitra <maitra(a)email.com> wrote:
>> >I am sorry to return to this, but I am still struggling to find out the
>> >to how to find files that had bad blocks in my old drive.
>> >ddrescue on the new disk found no problems, but I know there are affected
>> >files (the source disk was over 95% full), and I would like to know what
>> >those files are called.
>> See "man xfs_db". It looks like the "blockget -v -b
block-number" command may
>> provide useful info.
>Thanks very much for this information: it is very helpful.
>I do know the bytes and can figure out the sectors that are damaged. But I
>can't figure out how that translates to the block number of an xfs filesystem.
>Is there any reference for how to do this?
I would presume that it counts from the start of the partition containing the
file system. The xfs_db command "sb" consults the filesystem superblock and
should tell you the block size (4KiB is typical I think).
So I would start by:
- find the start sector of the partition containing the filesystem (counting
from zero); that is your base
- subtract that from the bad sector number; that should be the sector offset
into the XFS partition
- divide by the number of sectors per block (eg 512 byte sectors and 4KiB
blocks would mean 8 sectors per block); hopefully ddrescue tells you what
sector size it is using
Look up that block with "blockget" and then see if the corresponding file seems
to have corresponding damage in its data.
Disclaimer: I haven't tried this. But I can if you run into trouble, and I also
know an XFS expert I might consult if we can't figure this out ourselves.
Thanks very much! I have read the xfs_db manual, but it left me with more questions than
answers. Specifically blockget needs the "filesystem block number",
but what really is the filesystem block number? Is that distinct from
the allocation group block number? I issued one or two blockget -v -b
block-number commands, but they took so long and without knowing if I
was asking for the right block, I just gave up. I feel like I need
someone experienced in xfs structure to give me a sense of how to navigate
through the disk using xfs_db.
Many thanks again for your help!