On 2022-11-09, Wol <antli...@youngman.org.uk> wrote:
> On 09/11/2022 23:31, Grant Edwards wrote:
>>> If I recall correctly, it will add any unreadable blocks to its
>>> internal list of bad sectors, which it will then refuse to allocate
>>> in the future.
>
> I doubt you recall correctly.

The e2fsck man page states explicitly that a -c read failure will
cause the block to be added to the bad block inode. You're claiming
that is not what happens?

> You should ONLY EVER conclude a block is bad if you can't write to
> it. Remember what I said - if I read my 8TB drive from end-to-end
> twice, then I should *expect* a read error ...

OK...

>> I'm asking what happens to the file containing the bad block. Perphaps
>> nothing. The man page says the block is added to the "bad block
>> inode". If that block was already allocated, is the bad block is now
>> allocated to two different inodes?
>
> If a read fails, you SHOULD NOT do anything.

Thanks, but I'm not asking what I should do. I'm not asking what the
filesystem should do.  I'm not asking what disk-drive controller
firmware should do or does do with failed/spare blocks.

I'm asking what e2fsck -c does when the bad block is already allocated
to an inode. Specifically:

  Is the bad block removed from the inode to which it was allocated?

  Is the bad block left allocated to the previous inode as well as
  being added to the bad block inode?

We've gotten lots of answers to lots of other questions, but after
re-reading the thread a few times, I still haven't seen an answer to
the question I asked.

> If a write fails, you move the block and mark the failed block as
> bad. But seeing as you've moved the block, the bad block is no
> longer allocated to any file ...

Are you stating e2fsck -c will removed bad block from the inode to
which it was allocated before the scan? Is it replaced with a
different block? Or just left as an empty "hole" that can't be read
from or written to?

The e2fsck man page does not state that the bad block is removed from
the old inode, only that that bad block is added to the bad block inode.

If a block is allocated to an inode, I would call that "allocated to a
file". It's not a file that has a visible name that shows up in a
directory, but it's still a file.

--
Grant




Reply via email to