surda

Distinguished
Aug 7, 2009
265
0
18,790
i read the Faq but i didnt get the how the Raid 5 work.

just to make sure im on the right side,

raid 0 is performance and low security, for example lets say you have a 5 mb file, it will split into 2 2.5 mb file and save on both disks at the same time, this will give better performance for writing, and reading as will because it will read from both disks at the same time, if one disks fail, all data will be lost.

Raid 1, security basically one hard disk is a mirror of the other, every time u save a file, it will be copied to both disks at the same time, this might decrease writing performance, however will increase the reading performance because it will read from both hard disks, if one disk fails, u have the data in the other.

Raid 5, how does this work? ok u have 3 hard disks, are 2 of them used for performance while having a 3rd one just a mirror of both, so if one fails u can use the 3rd hard disk but will need to re-set up raid 0 or 1 or it works different?
 
First of all, the "splitting" of data on a RAID 0 volume doesn't split each file, it splits the actual disk sectors. So a 5MB file is still a 5MB file - what happens is that every other sector is on a different disk (ie, sector 0 is on disk 0, sector 1 is on disk 1, sector 2 is on disk 0, etc.). Once you've configured the RAID array this is completely transparent - when you use the file, view it in Explorer, etc it will look just like a file on a non-RAID volume.

(I've oversimplified the sector example, it's not really every other individual sector but rather groups of sectors depending on the "stripe" size, but that's the general idea).

Secondly, I wouldn't refer to RAID 1 and RAID 5 has having extra "security" - in the computer world the word "security" has to do with protection data against theft. What RAID 1 and RAID 5 provide is redundancy - like a jet aircraft with 4 engines, you can loose one and the jet stays in the air.

RAID 5 doesn't store all of the redundancy info on only one disk - in fact the redundancy info is spread around on all 3 disks. But on a 3-disk RAID 5 volume, for every 3 sectors (or "stripes"), two store data and one stores redundancy info.

RAID 5 redundancy is done using the Boolean XOR operation. When you write data sector 1 and 2, those blocks are XORed together and stored in a third sector. If a drive fails and you loose sector 1, you can recreate it by XORing sector 2 with the redundancy block. The redundancy block is often called "Parity", but it's not the same as odd/even parity used in other error correcting schemes.

(Again, this isn't really done on a sector-by-sector basis, but on a group of sectors depending on the "stripe" size).

RAID 5 performs poorly for writes because each time you write a new sector you have to read the old redundancy block, calculate the new XOR value, then write both the redundancy block and the new sector. The reads and writes can't be done in parallel, therefore write operations take at least twice as long in RAID 5 as in any other RAID organization.

And if a drive fails, RAID 5 performs very poorly because every sector has to be reconstructed by reading the other data sector and the redundancy sector.
 

surda

Distinguished
Aug 7, 2009
265
0
18,790
well explained, thanks for your help.

so raid 5 acts like this, when you save a file, sector 1 is stored in A, sector 2 is stored in b, and then both sector's copied to C.

so if drive A fails, then drive b will have to work with C, if drive B fails same thing, but if drive c fails, then everything will stay the same, but with 2 hard disks instead of 3, which makes it pretty much like raid 0, or i could be wrong.
 
Well, as I mentioned, the redundancy information isn't all stored on one disk, it's actually spread around all three disks. This is because putting all the redundancy information on one disk makes it a bottleneck since it would have to be accessed for EVERY write operation.

So what actually happens is that for every three sectors (or "stripes"), the data is organized like this:

Disk 0: Data block 0
Disk 1: Data block 1
Disk 2: Parity Block 0+1

Disk 0: Data block 2
Disk 1: Parity block 2+3
Disk 2: Data block 3

Disk 0: Parity block 4+5
Disk 1: Data block 4
Disk 2: Data block 5

Disk 0: Data block 6
Disk 1: Data block 7
Disk 2: Parity block 6+7

...and so on, with the parity (XOR) block rotated to a different disk for each set of three sectors/stripes. So loosing one disk in a RAID5 set does not leave you with a RAID 0 set no matter which disk fails.
 

surda

Distinguished
Aug 7, 2009
265
0
18,790
(RAID 0)

Disk 0: Data block 0
Disk 1: Data block 1

Disk 0: Data block 2
Disk 1: Data block 3

Disk 0: Data block 4
Disk 1: Data block 5

and so on...

(RAID 1)

Disk 0: Data block 0
Disk 1: Data block 0

Disk 0: Data block 1
Disk 1: Data block 1

Disk 0: Data block 2
Disk 1: Data block 2

and so on..

(RAID 5)

as u mentioned

is this correct?

u have alot of knowledge about raid configuration, so what about Raid 6 how does it work.

and thanks for explaining.



 

Yes, you have it correct. The only difference is that as I mentioned RAID is actually not done sector-by-sector, but rather in terms of "stripes" which comprise multiple sectors. For example, if you have a 4KByte stripe size, there are eight 512Byte sectors in each stripe. For RAID 0, that means:

Disk 0: Sectors 0-7
Disk 1: Sectors 8-15
Disk 0: Sectors 16-23
Disk 1: Sectors 24-31

...etc, and similar for the other RAID organizations as well.


RAID 6 is basically identical in concept to RAID 5, except that it stores two XOR ("parity") blocks per stripe. It requires at least 4 drives and allows the RAID array to continue working even if TWO drives fail. This is important in RAID sets with a lot of disks (for example, a 10-disk RAID volume) because with that many drives there's a significant risk of a second disk failure before the first one is replaced. The other option is to use RAID 5 with an extra "hot spare" disk which will automatically start rebuilding the RAID volume automatically when one drive fails without the need for any manual intervention (although of course sooner or later someone is going to have to replace the failed drive and the replacement will become the new "hot spare").

Wikipedia has a good article on the various RAID organizations here.

 

wuzy

Distinguished
Jun 1, 2009
900
0
19,010
If you're asking purely from an academic POV then what sminlal said is just that and faultless.

But if you want to apply RAID5 to real-world usage (either professionally or home use) it's a completely different story. There are countless downfalls to using RAID5, but with careful risk management and building a massive nearline storage array (6-8drives w/o expander) it can become a good option for cost-efficient redundancy.

This is not counting ZFS and RAID-Z which is a completely different story, although the theory is somewhat similar to RAID5.
 

wuzy

Distinguished
Jun 1, 2009
900
0
19,010


HDD selection (needs TLER), HDD quantities ($/GB vs. failure rate), uptime (rebuild rate), array reliability (replaceable controller or softRAID), performance (needs battery-backed writeback caching for adequate write performance)... etc.
In short RAID5 sounds great on paper, but as mentioned earlier it's not an easy game if you don't want to loose your data.

You can read up RAID-Z here. It's kinda long to explain.
 

surda

Distinguished
Aug 7, 2009
265
0
18,790
ok thanks guys for your help.

if i have asus p45 motherboard, with 2 x 500 hard disks, and i wanna do raid 0 setup, from where would i download the drivers to have raid 0 working.

and whats the best stripe size would be for performance?

and i can use more than 2 harddisk for raid 0 right, like get 4x500 gig and set up raid 0 for all them, by then each file will split into 4 harddisks insted of 2 and give more performance by sharing the load between the 4 harddisks right, but on the other hand increasing the risk, because if one fails then everything is gone.

last one, if i get one 500 gig hard disk and 250 gig, would i be able to do raid with them, i know i cant because at a point, one will be full while the other isnt, so i know it wont, but just wanna make sure.
 
from where would i download the drivers to have raid 0 working.
What OS are you using? Vista and Windows 7 should have the drivers built in - otherwise go to the support site for the motherboard.

and whats the best stripe size would be for performance?
For a desktop system the stripe size doesn't have all that big an impact - I'd just set it to 64K.

and i can use more than 2 harddisk for raid 0 right
Yes, although you get diminishing returns...

if i get one 500 gig hard disk and 250 gig, would i be able to do raid with them
Most RAID systems will let you RAID different sized disks, but they only use as much space per disk as the smallest one. So in your example you'd be wasting 250GB on the 500GB drive.