Gentoo Archives: gentoo-user

From: Laurence Perkins <lperkins@×××××××.net>
To: "gentoo-user@l.g.o" <gentoo-user@l.g.o>
Subject: RE: [gentoo-user] e2fsck -c when bad blocks are in existing file?
Date: Wed, 09 Nov 2022 16:53:27
Message-Id: MW2PR07MB4058A92A1654A7021A8E2D79D23E9@MW2PR07MB4058.namprd07.prod.outlook.com
In Reply to: Re: [gentoo-user] e2fsck -c when bad blocks are in existing file? by Michael
1 >
2 >-----Original Message-----
3 >From: Michael <confabulate@××××××××.com>
4 >Sent: Wednesday, November 9, 2022 12:47 AM
5 >To: gentoo-user@l.g.o
6 >Subject: Re: [gentoo-user] e2fsck -c when bad blocks are in existing file?
7 >
8 >On Tuesday, 8 November 2022 18:24:41 GMT Wols Lists wrote:
9 >
10 >> MODERN DRIVES SHOULD NEVER HAVE AN OS-LEVEL BADBLOCKS LIST. If they
11 >> do, something is seriously wrong, because the drive should be hiding
12 >> it from the OS.
13 >
14 >If you run badblocks or e2fsck you'll find the application asks to write data to the disk, at the end of the run. Yes, the drive's firmware should manage badblocks transparently to the filesystem, but I have observed in hdparm output reallocations of badblocks do not happen in real time. Perhaps the filesystem level badblocks list which is LBA based, acts as an intermediate step until the hardware triggers a reallocation? Not sure. :-/
15 >
16 >
17 Badblocks doesn't ask to write anything at the end of the run. You tell it whether you want a read test, a write-read test or a read-write-read-replace test at the beginning.
18
19 The drive's firmware will mark sectors as bad when a read fails. They will then get reallocated if a subsequent write cycle also fails. (Because, for example, I have a couple drives that have been running for over ten years and recently a couple sectors that hadn't been written in all that time bitrotted, but the surface was still fine even though the magnetism that had been there before had faded, so no need to reallocate.)
20
21 Controllerless drives that are managed at the FS layer do still exist, you just don't normally see them outside of embedded devices or really cheap flash drives.
22
23 Also, you might still want to use a bad blocks list on rotational drives if performance is paramount. When a sector has been remapped then any time you try to read that sector, the drive has to seek over to the spare sector that actually has the data, and then seek back to the original location. If that sector is marked as bad instead then the smarter filesystems will avoid it. Best case it's smart enough to avoid an extent crossing the boundary, worst case the seek distance is, at least, shorter and therefore quicker.
24
25 LMP

Replies

Subject Author
Re: [gentoo-user] e2fsck -c when bad blocks are in existing file? Michael <confabulate@××××××××.com>