2005-05-20 17:56:15

by Adam Miller

[permalink] [raw]
Subject: software RAID

Hi,
We're looking to set up either software RAID 1 or RAID 10 using 2 SATA
disks. If a disk in drive A has a bad sector, can it be setup so that the
array will read the sector from drive B and then have it rewrite the
bad sector on drive A? Please CC me in the response.

Thanks!
Adam Miller


2005-05-20 20:03:39

by Lennart Sorensen

[permalink] [raw]
Subject: Re: software RAID

On Fri, May 20, 2005 at 12:56:13PM -0500, Adam Miller wrote:
> We're looking to set up either software RAID 1 or RAID 10 using 2 SATA
> disks. If a disk in drive A has a bad sector, can it be setup so that the
> array will read the sector from drive B and then have it rewrite the
> bad sector on drive A? Please CC me in the response.

If a harddisk has a bad sector that is visible to the user (and hence
not remapped by the drive) then it is time to retire the drive since it
is out of spares and very damaged by that point.

If you have a bad sector, it doesn't go away by writing to it again. On
modern drives, if you see bad sectors the disk is just about dead, and
will probably be seen as such by the raid system which will then stop
using the disk entirely and expect you to replace it ASAP.

Len Sorensen

2005-05-20 20:23:00

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: software RAID

On Fri, 20 May 2005 16:03:34 EDT, Lennart Sorensen said:

> If you have a bad sector, it doesn't go away by writing to it again. On
> modern drives, if you see bad sectors the disk is just about dead, and
> will probably be seen as such by the raid system which will then stop
> using the disk entirely and expect you to replace it ASAP.

The one exception here is if you have a miswritten sector (usually caused by
unexpected power-down), which won't read back correctly - but running badblocks
with one of the 'write-verify' options will resurrect it.

If you have a drive that has a bad block in it even *after* badblocks has
re-written it, it's time to replace the drive *now*....

For the original poster: Breaking the mirror and then re-mirroring from the
"good" drive *might* recover the bad block when it re-writes it. But don't bet
on it...

("power fail" is about the only cause of recoverable bad blocks that I know of -
and if you're having power-fail issues on a RAID, I'd recommend you fix
*THAT* problem before it causes you more grief. A good UPS will more than pay
for itself in sysadmin sanity and peace of mind....)


Attachments:
(No filename) (226.00 B)

2005-05-20 20:30:04

by Grzegorz Kulewski

[permalink] [raw]
Subject: Re: software RAID

On Fri, 20 May 2005, Lennart Sorensen wrote:

> On Fri, May 20, 2005 at 12:56:13PM -0500, Adam Miller wrote:
>> We're looking to set up either software RAID 1 or RAID 10 using 2 SATA
>> disks. If a disk in drive A has a bad sector, can it be setup so that the
>> array will read the sector from drive B and then have it rewrite the
>> bad sector on drive A? Please CC me in the response.
>
> If a harddisk has a bad sector that is visible to the user (and hence
> not remapped by the drive) then it is time to retire the drive since it
> is out of spares and very damaged by that point.
>
> If you have a bad sector, it doesn't go away by writing to it again. On
> modern drives, if you see bad sectors the disk is just about dead, and
> will probably be seen as such by the raid system which will then stop
> using the disk entirely and expect you to replace it ASAP.

What do you mean "see bad sectors"?

Modern drives are trying to relocate sectors that can become bad in short
time. But this does not work 100% reliably. And sometimes disk wants to
relocate sector but the sector can not be read anymore. If this happens
disk will return read error when reading the sector _but_ when you will
write it again it will relocate it (with new data). And I think this was
the idea behind first post... To allow disk A to relocate not readable
sectors with correct data from disk B.


Grzegorz Kulewski

2005-05-20 20:53:50

by Adam Miller

[permalink] [raw]
Subject: Re: software RAID

Hi,
Yes, I want to know if the bad sector on disk A will be reallocated
when disk B tries to write to disk A.

Adam

On Fri, 20 May 2005, Grzegorz Kulewski wrote:

> On Fri, 20 May 2005, Lennart Sorensen wrote:
>
>> On Fri, May 20, 2005 at 12:56:13PM -0500, Adam Miller wrote:
>>> We're looking to set up either software RAID 1 or RAID 10 using 2 SATA
>>> disks. If a disk in drive A has a bad sector, can it be setup so that the
>>> array will read the sector from drive B and then have it rewrite the
>>> bad sector on drive A? Please CC me in the response.
>>
>> If a harddisk has a bad sector that is visible to the user (and hence
>> not remapped by the drive) then it is time to retire the drive since it
>> is out of spares and very damaged by that point.
>>
>> If you have a bad sector, it doesn't go away by writing to it again. On
>> modern drives, if you see bad sectors the disk is just about dead, and
>> will probably be seen as such by the raid system which will then stop
>> using the disk entirely and expect you to replace it ASAP.
>
> What do you mean "see bad sectors"?
>
> Modern drives are trying to relocate sectors that can become bad in short
> time. But this does not work 100% reliably. And sometimes disk wants to
> relocate sector but the sector can not be read anymore. If this happens disk
> will return read error when reading the sector _but_ when you will write it
> again it will relocate it (with new data). And I think this was the idea
> behind first post... To allow disk A to relocate not readable sectors with
> correct data from disk B.
>
>
> Grzegorz Kulewski
>

2005-05-20 21:50:34

by Michael Tokarev

[permalink] [raw]
Subject: Re: software RAID

Adam Miller wrote:
> Hi,
> We're looking to set up either software RAID 1 or RAID 10 using 2 SATA
> disks. If a disk in drive A has a bad sector, can it be setup so that
> the array will read the sector from drive B and then have it rewrite the
> bad sector on drive A? Please CC me in the response.

Adam,

There's no such functionality in linux software raid exists now.
Instead, as it is implemented now, the whole drive is kicked off
the array in case of *any* error in I/O path. There are patches
by Peter T. Breuer for 2.4 kernel for raid1, named "robust read",
which does just that, but the patches aren't accepted in mainline,
and in 2.6, the subsystem is too different. Maybe in some future...

And BTW, there's no reason to set up RAID10 array on top of 2 drives ;)

/mjt

2005-05-20 22:11:25

by NeilBrown

[permalink] [raw]
Subject: Re: software RAID

On Friday May 20, [email protected] wrote:
> Hi,
> We're looking to set up either software RAID 1 or RAID 10 using 2 SATA
> disks. If a disk in drive A has a bad sector, can it be setup so that the
> array will read the sector from drive B and then have it rewrite the
> bad sector on drive A? Please CC me in the response.

Not yet, but it is this functionality is very near the top of my TODO
list for md.

NeilBrown

2005-05-21 03:31:12

by Matthias Andree

[permalink] [raw]
Subject: Re: software RAID

On Sat, 21 May 2005, Neil Brown wrote:

> On Friday May 20, [email protected] wrote:
> > Hi,
> > We're looking to set up either software RAID 1 or RAID 10 using 2 SATA
> > disks. If a disk in drive A has a bad sector, can it be setup so that the
> > array will read the sector from drive B and then have it rewrite the
> > bad sector on drive A? Please CC me in the response.
>
> Not yet, but it is this functionality is very near the top of my TODO
> list for md.

Speaking of consistency, what is md's support for barriers like? Is it
safe to use write caches on the drives? (RAID1 assumed)

What if I'm using different drive models with different cache sizes
(isn't as unreasonable as it sounds as different drives may have
different margins WRT environmental influences), how does md figure what
is missing from one drive?

Is there anything short of break mirror and rebuild to guarantee
consistency until next reboot?

Documentation/md.txt is a bit lacking in these respects.

--
Matthias Andree

2005-05-21 19:05:31

by Alan

[permalink] [raw]
Subject: Re: software RAID

On Gwe, 2005-05-20 at 21:03, Lennart Sorensen wrote:
> If a harddisk has a bad sector that is visible to the user (and hence
> not remapped by the drive) then it is time to retire the drive since it
> is out of spares and very damaged by that point.

Sector reads failing due to poweroff during sector write or very
occasionally through vibration or other error may not always indicate
drive replacement is appropriate. Generally yes it does and SMART may
flag it.

Rewriting the sector is a good thing to try as ext2/3 fsck for example
does in this case.