I've been looking at my raid setups and I am beginning to really hate raid 1. During a drive failure, you don't know if the data on the other drive is correct or not. And what if one drive reads 1 and the other 0 without failure? How do you know which drive is correct?

Sure you could go with raid 6, but its a minimum of 4 drives. I think you can do the same with just 2 drives.

I've come up with a few raid levels, but why don't they exist?

  1. Raid on a single drive that also uses forward error correction like par2
  2. Like #1 but also mirrored (now you can ensure data is correct during failure)

This would require some custom hardware to perform the par2 calculation quickly. Also since its par2, for each drive you add to the array the par2 files can be smaller and smaller, since the amount of redundancy is the sum of the total size of the par2 files. See this to learn more about par2: http://www.quickpar.org.uk/AboutPAR2.htm

  • 1
    Given the R part of RAID, I'm not sure if #1 would technically qualify as being RAID :) Sounds like you're essentially looking for filesystem error correction implemented in hardware, yeah? – gharper May 27 '09 at 18:13
  • Yes, I guess I am – Pyrolistical May 27 '09 at 18:44
  • The funny thing is, the night I asked this question, my raid 1 fails at home. Since the drive did not fail completely, I now have two copies of every partition on the raid 1. I still don't know which drive is failing... – Pyrolistical May 28 '09 at 16:50

You just need a ZFS mirror. You're guaranteed consistent data based on COW and constant checksumming.

  • 1
    Sun did a study, and decided that you are right to worry. So they wrote zfs (which does many neat things also). Btrfs on Linux is headed the same way, but not production ready yet. Nothing else I know of does all that. – Ronald Pottol Sep 2 '09 at 4:40

If the question is "why can you not have RAID with a single drive that has error correction", the answer is in the "R" of RAID (Redundant Array of Independent Disks)... There would be no redundancy for disk failure. RAID is not designed to protect against data corruption (as par2 is), it is designed to protect against disk failure. A disk failure on a single disk with par2 would take the error correcting checksum down with the data, leaving you with no data at all.

  • 3
    Except RAID level 0, of course, where the probability of data loss is increased. – Justin Scott May 27 '09 at 18:12
  • 2
    Very true... the way I always remember RAID 0 is that it has "ZERO Redundancy" :) – Sean Earp May 27 '09 at 18:13
  • Raid is not primarily used to protect against data loss. – Nasa Dec 9 '09 at 10:37

RAID by definition can't be done on a single drive as RAID is "Redundant Array of Independent Disks" or "Redundant Array of Inexpensive Disks" depending on who you ask.

A proper raid controller won't write different data to each drive. As the data is written to one disk, it is also written to the other disk. If one disk doesn't accept the write then the block should be marked as bad. If the disk still isn't usable it should be marked as failed.

As smearp wrote RAID isn't designed to protect against data problems. It is a hardware redundancy solution.

  • I think you meant to say "Inexpensive" somewhere in your first sentence. – camh May 27 '09 at 21:02

You're right: with a mirror, it's hard to know which side is correct if they disagree.

There's an analogous problem with RAID: parity inconsistency. If a data block is damaged, you want to be able to reconstruct from parity — but what if a parity block is damaged? When a drive fails, the data in the matching reconstructed block will become damaged.

Strong checksums over blocks spanning multiple sectors can help: if the data block checksum fails but the parity block checksum succeeds, you can confidently reconstruct the data block. Strong checksums are no guarantee by themselves, however: if a drive misses out on a whole block write, it'll still carry its last validating checksum despite being out of date.

After a decade working for an enterprise storage vendor, I'm under no illusions: RAID is harder than it looks. It's easy to survive basic failure modes like full drive loss. It takes considerable more work and experience to survive more obscure failure modes like drives discarding writes or putting them in the wrong place.

Finally: RAID6 requires at least three drives, as it's designed to survive two simultaneous drive failures. It also protects you from the more common problem of media errors preventing full RAID5 reconstruction.

  • If your parity is damaged, then you don't have enough parity bits. If your checksum is damanged, then you didn't record the checksum multiple times. par2 does both – Pyrolistical May 28 '09 at 16:48
  • That's why the industry is shifting to RAID6: you get two parity bits per bit-stripe, not just one. If you think you've out-thought the industry, though, why not start a storage company? – Garth Kidd May 29 '09 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.