>
>-----Original Message-----
>From: Michael <[email protected]> 
>Sent: Wednesday, November 9, 2022 12:47 AM
>To: [email protected]
>Subject: Re: [gentoo-user] e2fsck -c when bad blocks are in existing file?
>
>On Tuesday, 8 November 2022 18:24:41 GMT Wols Lists wrote:
>
>> MODERN DRIVES SHOULD NEVER HAVE AN OS-LEVEL BADBLOCKS LIST. If they 
>> do, something is seriously wrong, because the drive should be hiding 
>> it from the OS.
>
>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.  :-/
>
>
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.

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.)

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.

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.

LMP

Reply via email to