Re: Why not just return an error?
From: Brad Campbell <hidden>
Date: 2016-10-11 04:00:47
On 11/10/16 05:55, Wols Lists wrote:
On 10/10/16 22:37, Andreas Klauer wrote:quoted
On Mon, Oct 10, 2016 at 09:47:04PM +0100, Anthony Youngman wrote:quoted
with a list of all blocks that failed to copy. Then we need to patch the low-level disk access code so that it reads this list of "bad blocks" and returns a read error if any attempt is made to read one. If a blockhdparm has that feature to mark sectors as bad (--make-bad-sector). not sure how that behaves on a re-write by md. I never tried it myself.I'm guessing it's useless ...
Not useless at all.
The point is that the disk sector is not bad. So you don't want to mark it as bad on the disk. But you know that the *data* in that block is bad, so you want the disk access layer to fake a read error when you try to read it. The intent is to deliberately trigger a rewrite by md.
I suggested this a while ago. Take the badblocks log, use hdparm to mark each bad sector as bad and put the drive back in the array. I even suggested potentially adding a feature to ddrescue to auto-mark the blocks as bad on the target drive. When md reads from that bad sector it will get an immediate error from the drive, reconstruct the data and rewrite it, clearing the bad sector. This absolutely prevents a rescued disk from returning zeros rather than bad data, and allows the good parts of the disk to participate in the array redundancy while stuff gets rectified. This is only useful where you have several dud disks in an array and the bad sectors are not in the same stripes, but for that pathological case it would allow ddrescuing onto new drives and reconstructing the array without data loss. Whereas simply using ddrescued disks will happily return zeros where the holes are. Regards, Brad