Gentoo Archives: gentoo-user

From: Grant Edwards <grant.b.edwards@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: e2fsck -c when bad blocks are in existing file?
Date: Thu, 10 Nov 2022 00:19:01
Message-Id: tkhg16$1033$1@ciao.gmane.io
In Reply to: Re: [gentoo-user] Re: e2fsck -c when bad blocks are in existing file? by Wol
1 On 2022-11-09, Wol <antlists@××××××××××××.uk> wrote:
2 > On 09/11/2022 23:31, Grant Edwards wrote:
3 >>> If I recall correctly, it will add any unreadable blocks to its
4 >>> internal list of bad sectors, which it will then refuse to allocate
5 >>> in the future.
6 >
7 > I doubt you recall correctly.
8
9 The e2fsck man page states explicitly that a -c read failure will
10 cause the block to be added to the bad block inode. You're claiming
11 that is not what happens?
12
13 > You should ONLY EVER conclude a block is bad if you can't write to
14 > it. Remember what I said - if I read my 8TB drive from end-to-end
15 > twice, then I should *expect* a read error ...
16
17 OK...
18
19 >> I'm asking what happens to the file containing the bad block. Perphaps
20 >> nothing. The man page says the block is added to the "bad block
21 >> inode". If that block was already allocated, is the bad block is now
22 >> allocated to two different inodes?
23 >
24 > If a read fails, you SHOULD NOT do anything.
25
26 Thanks, but I'm not asking what I should do. I'm not asking what the
27 filesystem should do. I'm not asking what disk-drive controller
28 firmware should do or does do with failed/spare blocks.
29
30 I'm asking what e2fsck -c does when the bad block is already allocated
31 to an inode. Specifically:
32
33 Is the bad block removed from the inode to which it was allocated?
34
35 Is the bad block left allocated to the previous inode as well as
36 being added to the bad block inode?
37
38 We've gotten lots of answers to lots of other questions, but after
39 re-reading the thread a few times, I still haven't seen an answer to
40 the question I asked.
41
42 > If a write fails, you move the block and mark the failed block as
43 > bad. But seeing as you've moved the block, the bad block is no
44 > longer allocated to any file ...
45
46 Are you stating e2fsck -c will removed bad block from the inode to
47 which it was allocated before the scan? Is it replaced with a
48 different block? Or just left as an empty "hole" that can't be read
49 from or written to?
50
51 The e2fsck man page does not state that the bad block is removed from
52 the old inode, only that that bad block is added to the bad block inode.
53
54 If a block is allocated to an inode, I would call that "allocated to a
55 file". It's not a file that has a visible name that shows up in a
56 directory, but it's still a file.
57
58 --
59 Grant

Replies

Subject Author
RE: [gentoo-user] Re: e2fsck -c when bad blocks are in existing file? Laurence Perkins <lperkins@×××××××.net>