NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
NASNoob11
Sep 12, 2013Aspirant
X-raid vs. X-raid2
Should I consider updating my 3 current NAS to use X-RAID2 (see sig below)? OK. From the gracious help of Vanderwerwe and StephenB, I have brought back online my old Duo-v2. I chose to ?format/char...
fastfwd
Sep 15, 2013Virtuoso
So... Here's what I hope is a simplified explanation of how it works:
In a real system, drives store billions of bytes each, and each byte is a number in the range 0-255. For ease of explanation, let's imagine that our drives are ridiculously small -- only large enough to store 16 bytes each -- and that each "byte" can only be a single digit in the range 0-9. I'll show how a file is stored on a single drive, on a two-drive RAID array, and on larger 3- and 4-drive arrays.
The file we're going to store is ten bytes long: "2024561212".
With one 16-byte drive, the file is stored like this:
With two drives, the data is mirrored. This arrangement is called RAID1:
If one drive fails, you can still read your data from the other drive. When you replace the failed drive, the NAS will rebuild the array by copying data to the new drive from the old one:
To expand the array, you replace the 16-byte drives with 32-byte drives, one at a time:
You'll often see this type of expansion -- replacing small drives with bigger drives -- referred to as "vertical" expansion. Unfortunately, I've chosen to diagram each drive as a horizontal row in order to save space in this post, so in my diagram the expansion looks horizontal. Sorry about that.
Anyway... With three or more drives, we can achieve single-drive redundancy without wasting half of our physical array. To do that, the data is striped across the drives and parity is added. Parity is extra data computed from the original data by some formula; for this example, the formula we'll use is "sum the bytes in each column, then subtract the rightmost digit of the sum from nine". This striped-with-parity arrangement is called RAID5. Here's how it looks in a simplistic form with all the parity on a single drive:
See how that works? 2+0=2, 9-2=7. 2+4=6, 9-6=3. 5+6=11, rightmost digit is 1, 9-1=8. 1+2=3, 9-3=6. 1+2=3, 9-3=6. 0+0=0, 9-0=9. And those are the first six parity digits on drive 3: 738669.
The cool thing about this arrangement is that it's not just drive 3 that is the parity for drives 1 and 2; every drive is the parity for the other two drives. You can check this by computing the parity for, say, drives 2 and 3: 0+7=7, 9-7=2. 4+3=7, 9-7=2. 6+8=14, rightmost digit is 4, 9-4=5. 2+6=8, 9-8=1. 2+6=8, 9-8=1. 0+9=9, 9-9=0. Sure enough, the first six digits on drive 1 are 225110.
This mutual parity means is that if we lose any one of our drives, we can reconstruct the data that was on it by computing the parity of the other drives. For example, say we lost drive 2. We can replace it and the NAS will rebuild the array:
When you add a fourth drive, the NAS re-stripes the data across the drives and recomputes the parity:
One final note: I've been showing the parity all on one drive for simplicity, but in a real system, the computed parity isn't stored that way because doing so would lower performance and overwork the parity drive (because its data would have to be updated whenever the data on any other drive was updated). Instead, the parity is spread across all the drives, like this:
This interleaving doesn't affect the failure-resistance of the array. If one drive fails, the NAS can still rebuild it exactly as if all the parity were on a single drive.
In a real system, drives store billions of bytes each, and each byte is a number in the range 0-255. For ease of explanation, let's imagine that our drives are ridiculously small -- only large enough to store 16 bytes each -- and that each "byte" can only be a single digit in the range 0-9. I'll show how a file is stored on a single drive, on a two-drive RAID array, and on larger 3- and 4-drive arrays.
The file we're going to store is ten bytes long: "2024561212".
With one 16-byte drive, the file is stored like this:
- 2024561212000000 16B usable, 6B free (blue is our data, green is free space)
With two drives, the data is mirrored. This arrangement is called RAID1:
- 2024561212000000 16B usable, 6B free
2024561212000000
If one drive fails, you can still read your data from the other drive. When you replace the failed drive, the NAS will rebuild the array by copying data to the new drive from the old one:
- Replace failed drive 1:
0000000000000000 16B usable, 6B free (yellow = unusable space)
2024561212000000
Rebuild:
2024561212000000 16B usable, 6B free
2024561212000000
To expand the array, you replace the 16-byte drives with 32-byte drives, one at a time:
- Replace drive 1:
00000000000000000000000000000000 16B usable, 6B free
2024561212000000
Rebuild:
20245612120000000000000000000000 16B usable, 6B free (note that only the mirrored portion of drive 1 is usable)
2024561212000000
Replace drive 2:
20245612120000000000000000000000 16B usable, 6B free
00000000000000000000000000000000
Rebuild:
20245612120000000000000000000000 32B usable, 22B free
20245612120000000000000000000000
You'll often see this type of expansion -- replacing small drives with bigger drives -- referred to as "vertical" expansion. Unfortunately, I've chosen to diagram each drive as a horizontal row in order to save space in this post, so in my diagram the expansion looks horizontal. Sorry about that.
Anyway... With three or more drives, we can achieve single-drive redundancy without wasting half of our physical array. To do that, the data is striped across the drives and parity is added. Parity is extra data computed from the original data by some formula; for this example, the formula we'll use is "sum the bytes in each column, then subtract the rightmost digit of the sum from nine". This striped-with-parity arrangement is called RAID5. Here's how it looks in a simplistic form with all the parity on a single drive:
- 2251100000000000 32B usable, 22B free (red = parity)
0462200000000000
7386699999999999
See how that works? 2+0=2, 9-2=7. 2+4=6, 9-6=3. 5+6=11, rightmost digit is 1, 9-1=8. 1+2=3, 9-3=6. 1+2=3, 9-3=6. 0+0=0, 9-0=9. And those are the first six parity digits on drive 3: 738669.
The cool thing about this arrangement is that it's not just drive 3 that is the parity for drives 1 and 2; every drive is the parity for the other two drives. You can check this by computing the parity for, say, drives 2 and 3: 0+7=7, 9-7=2. 4+3=7, 9-7=2. 6+8=14, rightmost digit is 4, 9-4=5. 2+6=8, 9-8=1. 2+6=8, 9-8=1. 0+9=9, 9-9=0. Sure enough, the first six digits on drive 1 are 225110.
This mutual parity means is that if we lose any one of our drives, we can reconstruct the data that was on it by computing the parity of the other drives. For example, say we lost drive 2. We can replace it and the NAS will rebuild the array:
- Replace drive 2:
2251100000000000 32B usable, 22B free
0000000000000000
7386699999999999
Rebuild:
2251100000000000 32B usable, 22B free
0462200000000000
7386699999999999
2+7=9, 9-9=0. 2+3=5, 9-5=4. 5+8=13, rightmost digit is 3, 9-3=6. 1+6=7, 9-7=2. 1+6=7, 9-7=2. 0+9=9, 9-9=0.
When you add a fourth drive, the NAS re-stripes the data across the drives and recomputes the parity:
- Add drive 4:
2251100000000000 32B usable, 22B free
0462200000000000
7386699999999999
0000000000000000
Restripe and recompute parity:
2412000000000000 48B usable, 38B free
0520000000000000
2610000000000000
5457999999999999
2+0+2=4, 9-4=5. 4+5+6=15, rightmost digit is 5, 9-5=4. 1+2+1=4, 9-4=5. 2+0+0=2, 9-2=7. 0+0+0=0, 9-0=9.
One final note: I've been showing the parity all on one drive for simplicity, but in a real system, the computed parity isn't stored that way because doing so would lower performance and overwork the parity drive (because its data would have to be updated whenever the data on any other drive was updated). Instead, the parity is spread across all the drives, like this:
- 2417000900090009 48B usable, 38B free
0552009000900090
2420090009000900
5610900090009000
This interleaving doesn't affect the failure-resistance of the array. If one drive fails, the NAS can still rebuild it exactly as if all the parity were on a single drive.
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!