public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Grant Edwards <grant.b.edwards@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] Re: e2fsck -c when bad blocks are in existing file?
Date: Tue, 8 Nov 2022 14:28:02 -0000 (UTC)	[thread overview]
Message-ID: <tkdp1i$1v2$1@ciao.gmane.io> (raw)
In-Reply-To: 3193783.oiGErgHkdL@lenovo.localdomain

On 2022-11-08, Michael <confabulate@kintzios.com> wrote:
> On Tuesday, 8 November 2022 03:31:07 GMT Grant Edwards wrote:
>> I've got an SSD that's failing, and I'd like to know what files
>> contain bad blocks so that I don't attempt to copy them to the
>> replacement disk.
>> 
>> According to e2fsck(8):
>> 
>>        -c     This option causes e2fsck to use badblocks(8)  program  to  do
>>  a read-only scan of the device in order to find any bad blocks.  If any
>> bad blocks are found, they are added to the bad  block  inode to  prevent
>> them from being allocated to a file or directory.  If this option is
>> specified twice, then the bad block scan  will  be done using a
>> non-destructive read-write test.
>> 
>> What happens when the bad block is _already_allocated_ to a file?

> Previously allocated to a file and now re-allocated or not, my understanding 
> is with spinning disks the data in a bad block stays there unless you've dd'ed 
> some zeros over it.  Even then read or write operations could fail if the 
> block is too far gone.[1]  Some data recovery applications will try to read 
> data off a bad block in different patterns to retrieve what's there.  Once the 
> bad block is categorized as such it won't be used by the filesystem to write 
> new data to it again.

Thanks. I guess I should have been more specific in my question.

What does e2fsck -c do to the filesystem structure when it discovers a
bad block that is already allocated to an existing inode?

Is the inode's chain of block groups left as is -- still containing
the bad block that (according to the man page) "has been added to the
bad block inode"?  Presumably not, since a block can't be allocated to
two different inodes.

Is the "broken" file split into two chunks (before/after the bad
block) and moved to the lost-and-found?

Is the man page's description only correct when the bad block is
currently unallocated?

--
Grant






  reply	other threads:[~2022-11-08 14:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  3:31 [gentoo-user] e2fsck -c when bad blocks are in existing file? Grant Edwards
2022-11-08 13:20 ` Michael
2022-11-08 14:28   ` Grant Edwards [this message]
2022-11-08 17:55     ` [gentoo-user] " Laurence Perkins
2022-11-08 18:49       ` Michael
2022-11-08 21:52       ` John Covici
2022-11-09 23:31       ` Grant Edwards
2022-11-09 23:54         ` Wol
2022-11-10  0:18           ` Grant Edwards
2022-11-10  0:37             ` Laurence Perkins
2022-11-08 18:24   ` [gentoo-user] " Wols Lists
2022-11-09  8:46     ` Michael
2022-11-09 16:53       ` Laurence Perkins
2022-11-12 13:38         ` Michael
2022-11-12 16:44           ` [gentoo-user] " Grant Edwards
2022-11-12 19:34             ` Michael
2022-11-13  3:54               ` Grant Edwards
2022-11-14 16:37                 ` Laurence Perkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='tkdp1i$1v2$1@ciao.gmane.io' \
    --to=grant.b.edwards@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox