Re: Linux kernel - Libata bad block error handling to user mode program

From: Mark Lord
Date: Thu Mar 04 2010 - 09:41:59 EST


On 03/04/10 09:17, Greg Freemyer wrote:
..
I think / suspect your major problem is you say above that you use a
512-byte buffer to wipe with. The kernel is using 4K pages. So when
you write to a 4K section of the drive for the first time, the kernel
implements read-modify-write logic.

Your i/o failures are almost certainly on the read cycle of the above,
not the write cycle. You need to move to 4K buffers and you need to
ensure your 4K writes are aligned with how the kernel is working with
the disk. ie. You need your 4K buffer to perfectly align with the
kernels 4K block handling so you never have a read-modify-write cycle.
..

You'll also need to disable Linux read-ahead for the drive,
or it may try reading beyond even the 4KB block.

But really.. isn't "hdparm --security-erase NULL /dev/sdX" good enough ???

Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/