Skip to contentSkip to conversation

Force parity resync on raid5?

DISCUSSION Philip Molter 3 participants 6 messages Aug 10, 2004 – Aug 11, 2004 MD RAID

lore
Share & tools
lore
#0 lore raw
Quoted 14 lines · Gordon Henderson
Quoted 3 lines · Philip Molter

How do I force a parity resync on a raid5 array? Under 2.4, I would do this by hard cycling the box and when it came back up, it would automatically resync the array. Under 2.6, this appears to have gone away.

I don't know about 2.6, (still living with 2.4) but can't you simply do:

raidhotremove /dev/mdX /dev/hdYZ

followed by

Quoted 8 lines

raidhotadd /dev/mdX /dev/hdYZ

or /dev/sdYZ if SCSI disks...

However, picking the right disk to remove might be tricky... And if you were at all unsure about data on the disks, maybe rebooting and doing a hard fsck of the partition(s) in maintenance mode might be a good thing too...

Nope, I want something that will specifically resync the parity from the known good data on the disks. Thanks to the raid5 resync bug from earlier 2.6 kernels, I have hundreds of systems with terabytes of data that have perfectly good data sitting on raid5 arrays with corrupt parity. If I remove a drive to force a resync, the data is immediately corrupted.

Linux RAID *has* to have sort of way to force a parity resync. If it doesn't have one, it needs one. That's a glaring omission to make.

Philip

#1 lore raw
Quoted 3 lines · On Tuesday August 10, [email protected] wrote:

Linux RAID *has* to have sort of way to force a parity resync. If it doesn't have one, it needs one. That's a glaring omission to make.

Well, you get what you pay for.....

The easiest way to force a resync would be to re-create the array.

- Note the exact order of the drives in the array, and the chunk size.
- Stop the array.
- Create the array with mdadm using --force. That bit is important.

    mdadm --create /dev/mdX --level=5 --force --disks=whatever \
       --chunksize=64k  /dev/sda1 /dev/sdb1 .....

Remember the --force. If you don't have it, you will get a recovery cycle that rebuilds one drive against the others rather than a resync that checks and corrects parity.

This will recreate the array (almost) exactly as it currently is, but it will not be marked 'clean', so a parity check-and-correct will happen.

It should be fairly easy to add a --update=dirty option to

    "mdadm --assemble"

to make that a bit easier. I might do that in a day or two (though I might not).

Ofcourse, it would be really nice if you could just tell md to run a resync pass. It's on my todo list, but it isn't the only thing. Clean, well-designed, small patches gladly accepted.

NeilBrown

(don't forget the --force)

#2 lore raw
Quoted 6 lines · Neil Brown
Quoted 2 lines · On Tuesday August 10, [email protected] wrote:

Linux RAID *has* to have sort of way to force a parity resync. If it doesn't have one, it needs one. That's a glaring omission to make.

Well, you get what you pay for.....

Tell me where to send the checks. Seriously. I know you guys work hard on this stuff and I will gladly donate to the fund to have important (to me) features implemented.

Quoted 5 lines

The easiest way to force a resync would be to re-create the array.

- Note the exact order of the drives in the array, and the chunk size.
- Stop the array.
- Create the array with mdadm using --force. That bit is important.

Do I need to note the parity algorithm, too?

Quoted 10 lines
    mdadm --create /dev/mdX --level=5 --force --disks=whatever \
       --chunksize=64k  /dev/sda1 /dev/sdb1 .....

Remember the --force. If you don't have it, you will get a recovery cycle that rebuilds one drive against the others rather than a resync that checks and corrects parity.

This will recreate the array (almost) exactly as it currently is, but it will not be marked 'clean', so a parity check-and-correct will happen.

Does this destroy the data on the array? I seem to remember getting this advice a while back when encountering a similar problem and seeing my data go up in smoke. I could easily have done something wrong, though.

#3 lore raw
Quoted 4 lines · On Tuesday August 10, [email protected] wrote:
Quoted 2 lines · Neil Brown

On Tuesday August 10, [email protected] wrote:

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Linux RAID *has* to have sort of way to force a parity resync. If it doesn't have one, it needs one. That's a glaring omission to make.

Well, you get what you pay for.....

Tell me where to send the checks. Seriously. I know you guys work hard on this stuff and I will gladly donate to the fund to have important (to me) features implemented.

Hmmm. Awkward.
I'm not averse to doing a bit of contracting at times (taking un-paid leave or similar from my day job), but having a fund that people can donate to might be a bit more awkward...

Quoted 8 lines
Quoted 6 lines

The easiest way to force a resync would be to re-create the array.

- Note the exact order of the drives in the array, and the chunk size.
- Stop the array.
- Create the array with mdadm using --force. That bit is important.

Do I need to note the parity algorithm, too?

Yes, though I strongly suspect the array was created with the default parity algorithm, so it shouldn't make any difference.

Quoted 8 lines
Quoted 8 lines
    mdadm --create /dev/mdX --level=5 --force --disks=whatever \
       --chunksize=64k  /dev/sda1 /dev/sdb1 .....

Remember the --force. If you don't have it, you will get a recovery cycle that rebuilds one drive against the others rather than a resync that checks and corrects parity.

Quoted 7 lines
Quoted 3 lines

This will recreate the array (almost) exactly as it currently is, but it will not be marked 'clean', so a parity check-and-correct will happen.

Does this destroy the data on the array? I seem to remember getting this advice a while back when encountering a similar problem and seeing my data go up in smoke. I could easily have done something wrong, though.

No, it doesn't destroy the data - provided you have the configuration exactly the same as before. It will only update the superblocks and correct all parity blocks. Data blocks won't be changed.

However I have just release mdadm 1.7.0 which supports
--assemble --update=resync

which will cause an array to resync immediately after being assembling. This don't help you for an array with a root filesystem on it, but should do want you want for any other array.

NeilBrown

#4 lore raw
Quoted 6 lines

However I have just release mdadm 1.7.0 which supports
--assemble --update=resync

which will cause an array to resync immediately after being assembling. This don't help you for an array with a root filesystem on it, but should do want you want for any other array.

Neil,

Thank you. I'll let you know if we have any problems with the resyncing.

Philip

#5 lore raw
In reply to Neil Brown

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Brown wrote:

|On Tuesday August 10, [email protected] wrote:
|
|>Neil Brown wrote:
|>
|>>On Tuesday August 10, [email protected] wrote:
|>>
|>>>Linux RAID *has* to have sort of way to force a parity resync.  If it
|>>>doesn't have one, it needs one.  That's a glaring omission to make.
|>>
|>>Well, you get what you pay for.....
|>
|>Tell me where to send the checks.  Seriously.  I know you guys work
hard
|>on this stuff and I will gladly donate to the fund to have important
(to
|>me) features implemented.
|
|Hmmm. Awkward.
|I'm not averse to doing a bit of contracting at times (taking un-paid
|leave or similar from my day job), but having a fund that people can
|donate to might be a bit more awkward...

So, given a request for a feature:
Set up a page with a rough estimate of the cost. eg, parity resync: 2 weeks effort @ £500/day (casually picked this as a v. cheap 'commercial consultant rate' - reasonable contract rate) is £5000. Detailed estimate + design maybe a day or more at the same rate (maybe just if anyone were to ask or mandatory if you felt you would need to do this before committing to a feature).
You could add promise emails to the total (eg company X may promise £2k but not until the rest has been promised up)
If you wanted to use a non-refundable paypal type account and update the page as thankyous/donations/promises arrive, that could give people an idea of the likely commitment elsewhere in the community - and if you get a few £10 thankyous from home users then maybe it'll affect your priority for stuff you'd have done at some point anyway.

And put the url in your .sig :)

Just a thought.

David

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBGeWN8LvjTle4P1gRApKmAJ4s+gngPl8W0FGqe2HduYQnkUuSPACePFJ2 p/a2zGQLm6xr8Ya/CRaKTOc=
=tWTX
-----END PGP SIGNATURE-----

-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html