Skip to contentSkip to conversation

mdadm and disk failures

DISCUSSION Mike Power 4 participants 5 messages Jun 16, 2011 MD RAID

lore
Share & tools
lore

Mike Power

author
#0 lore raw

I was looking around the wiki and I could not find the answer.

I wanted to know if the raid system will recover bad blocks lost on the one device when the copies of those blocks are available on another. From what I understand when a hard drive loses a block it replaces it with another block but it can not recover the data. At this point I do not know what the raid system does. At one point in the past my understanding is, the raid system did nothing. If it read from the disk that had the block it gets garbage for data. Conceptually the raid system could read the data from one disk and write it to the copy on the other and restore the data.

Is the raid system capable of recovering and restoring bad blocks?

Mike Power

#1 lore raw
Quoted 2 lines · Mike Power

Is the raid system capable of recovering and restoring bad blocks?

Yes, and it does so admirably. You will see a message in your system log to the effect that it had recovered the (or those) bad sector(s).

Brad

#2 lore raw
In reply to Mike Power
Quoted 3 lines · On Wed, 15 Jun 2011 20:37:31 -0700 Mike Power <[email protected]> wrote:

From what I understand when a hard drive loses a block it replaces it
with another block but it can not recover the data.
If it read from the disk that had the block it gets garbage for data.

This is not true, an HDD will never return garbage data just because it needed to remap a bad sector. And that's the reason why bad sectors will return I/O error (unreadable) instead, and are not remapped anywhere until you try to WRITE into these sectors. At that moment, when the hard disk has new user data for that sector, it can finally do the remap and put it somewhere else on a remapped good sector.

Signature · 2 lines
With respect,
Roman
#3 lore raw
Quoted 1 line · Roman Mamedov

At that moment, when the hard disk has new user data for that sector, it can finally do the remap and put it somewhere else on a remapped good sector.

Just to be clear, it won't necessarily remap the sector. It might succeed in writing the new data to it and determine the sector isn't really bad, and not remap it.

Signature · 1 line
Mikael Abrahamsson    email: [email protected]
author
#4 lore raw
In reply to Roman Mamedov

Ahh I understand more clearly now. Because the failing drive will report an IO error the raid system can respond reactively by getting the data else where and writing it to the failing disk. Earlier I had thought that the raid system might periodically poll the disks to see what blocks were lost and correct them.

This makes me much more interested in setting up a raid system above and beyond the performance benefit.