On Sat, 20 Jun 2026 16:26:59 -0400 (EDT)
Robert Heller <[email protected]> wrote:

> I've always thought that the hardware controller checksums raw disk
> blocks (sectors) as part of the low-level I/O processing in the
> controller hardware's "firmware" and that this is how the controller
> knows it has a bad block.

Correct.

Each sector has the data, and enough checksum data that the controller
can test the data for integrity, and correct some small errors (a few
bytes, typically).

When the controller detects an error it attempts to correct it. If it
succeeds, it returns the data to the computer and re-writes the data to
the platter. If that write fails, it marks the sector as bad, and
selects a spare sector to replace it.

If the attempt to correct the error fails, I believe the drive reports
the error to the computer, and allocates a spare sector to replace the
failed one. It is then up to the OS or even application software to
generate a replacement sector or otherwise handle the problem.

These days the controller runs surface tests in the background to
detect and correct errors before they get too big to correct. In
addition, you can run an extended self-test, which includes a surface
test, with SMART software.

There is a fixed supply of spare sectors to be allocated; when that is
exhausted the OS starts marking bad blocks. These days that means it is
time to replace the drive. This is why it is important to monitor
drives for these (and other) failures with SMART software.

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/

Reply via email to