# Raid 5

Tyler Strickland tyler at tylers.org
Fri Dec 2 11:10:51 MST 2005

```On 12/02/2005 10:17 AM, Corey Edwards wrote:
> OK, that is what I said but upon reflection that's not what I was
> actually thinking of. What I was getting at is that *any* two disks in a
> RAID 5 fail and you're hosed. With a RAID 10 you need a certain
> combination of disks to fail. My statistics is way too rusty to make a
> stab at the numbers, but even I can see that a RAID 10 is a lot less
> risky. I would be interested in seeing the calculations if anybody out
> there is up for it.

Well my statistics are a bit rusty, but here's a go:

I will assume the probability of a single drive failing at a given
moment is 1/1000.  If we assume that drive failures are independent, or
in other words a single drive failure does not change the probability of
another drive's failure, the probability of two drives failing is found
by multiplying their probabilities.

Thus, in a RAID 1 setup with two drives, the probability of both drives
failing would be found by multiplying 1/1000 * 1/1000, giving
1/1,000,000.  The probability of any one drive failing is P(A) + P(B) -
P(A and B), so the probability of losing just one drive is 2/1000 -
1/1000000, which is approximately 2/1000 or 1/500.  The probility of
losing both drives is found by multiplying their probabilities: 1/1000 *
1/1000 = 1/1,000,000.

If we increase our setup to a RAID 10 with 4 drives, we must now lose
two specific drives to have failure.  If we have drives A, B, C, and D,
with A and B being the source and C and D being the mirror, we must now
lose either A and C or B and D to lose data.  Losing A and B, A and D,
or C and B or C and D would still allow full recovery.  The probability
of A and B, as found above, is 1/1,000,000.  The probability of A and B
or A and D is given by the other formula used above ( P(A) + P(B) - P(A
and B) ), so we have 1/1000000 + 1/1000000 - 1/1000000000000.  This
gives us a failure probability of roughly 2/1,000,000 or 1/500,000.
Adding a third pair would give a failure probability of 3/1,000,000.

For a RAID 5 setup with 4 drives, we still need two drives to fail, but
those drives can be any two from the bunch.  Thus the set of failing
circumstances is A and B, A and C, A and D, B and C, B and D, and C and
D.  By the formulas used above, the failure of probability is 6/1,000,000.

In conclusion, here are the final probabilities:
RAID 5, 4 drives:   6/1,000,000 = 0.000006
RAID 1, 2 drives:   1/1,000,000 = 0.000001
RAID 10, 4 drives:  2/1,000,000 = 0.000002
RAID 10, 6 drives:  3/1,000,000 = 0.000006

Basically, RAID 1, RAID 10, and RAID 5 differ little in probability of
failure.  For any one of these configurations, you still have to lose
two drives to fail, and the probability of that is small, as we see
above.  One might compare it to buying four lottery tickets instead of
one - you're still probably going to lose, even though your chances of
winning are slightly higher than before.

The probabilities above are not valid in the following circumstances:
1.  The 1/1000 estimate is not accurate.  Our formulas are accurate,
though, so the new probility may simply replace the old in the calculations.
2.  The probability of a drive failure changes after another drive fails
(they are not independent).  In this case, the formulas used must change
and the resultant probabilities would change as well.
3.  The probability of failure differs between the drives.  This may be
the case if you mix and match brands, for example.

Another factor to take into consideration would be environmental factors
that increase the probability of failure over time, such as heat or
vibration.

--Tyler

```