how does raid work?

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
maybe this isnt a very high tech question...but im curious how raid actually works and how beneficial it is to a single drive
 

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
i just learned from someone that it writes some data to both drives...raid 0 i am talking about...so how would you defrag it?

still looking for some help
 

blahblah99

Platinum Member
Oct 10, 2000
2,689
0
0
it depends on which raid mode you run your hard drives.

i believe it goes like this:

Raid 0 (stripe mode) - even bits written on one drive, odd on the other... Total capacity is the addition of the two hard drives. need 2 hard drives
Raid 1 - safe mode - same data is written on both hard drive, one is for backup... total capacity is the size of one hard drive. need 2 hard drives

of course, there are other combinations of raids such as raid 0+1. raid only works with 2 or more drives and does absolutely nothing to 1 drive.
 

bizmark

Banned
Feb 4, 2002
2,311
0
0


<< so how would you defrag it? >>



Once the basic problem of getting the controller to think of the two disks as one disk, the problem of defragging goes away. Essentially a striped RAID is like writing a book in two separate volumes: write one line in volume A, the second line in volume B, the third line in A, the fourth line in B, and so on. Then getting the controller to work properly is essentially fixing your eyes so that you can read both volumes with both eyes simultaneously and incorporate the two in your brain to make one coherent structure.

So essentially we have a one-to-one and onto mapping from the union of A and B to C (the virtual volume): c_i={a_((i+1)/2) if i is odd; b_(i/2) if i is even; a_i, b_i in A and B respectively} (this is just an example and it could be done numerous other ways, but this is the most straightforward. If you wanted, you could go backwards on B and forwards on A....). So, at its simplest, c_1=a_1, c_2=b_1, c_3=a_2, c_4=b_2, and so forth. So c_200 (the 200th line in the virtual volume C) is just b_100, and c_201 is a_101.

Once this mapping is set, then the defragging becomes no more complicated than usual. The software thinks of the two drives as one big drive, and defrags it as such. If, in the process of defragging, line c_201 needs to be moved to line c_194, it will be moved from disk A to disk B but the defragging software is thinking of moving c_201 to c_194 and not a_101 to b_97. The mapping is handled automatically by the raid controller.

edit: This whole post was talking only about RAID 0.
 

sun818

Golden Member
Jul 11, 2000
1,147
0
0
I assume then, RAID 0 stripe mode gives the performance (read and write), while providing no data protection?
And RAID 1 provides data protecting while giving a boost to read performance only? I have a decent sized database that I perform a lot of queries on, so I though RAID 1 would give me data protection and read performance I want. If one of the drives go bad, can I just plug the other hard drive into a regular hard disk controller and have it running without modifications?
 

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
i think what they are saying is raid 0 is fast, raid 1 is safe, and raid 0+1 is safe and fast, but raid 1 is not faster...or am i incorrect?
 

bizmark

Banned
Feb 4, 2002
2,311
0
0


<< I assume then, RAID 0 stripe mode gives the performance (read and write), while providing no data protection?
And RAID 1 provides data protecting while giving a boost to read performance only? I have a decent sized database that I perform a lot of queries on, so I though RAID 1 would give me data protection and read performance I want. If one of the drives go bad, can I just plug the other hard drive into a regular hard disk controller and have it running without modifications?
>>



You're right about RAID 0. No redundency = no protection. You're also right about RAID 1. Improved read speed and complete data protection.

A RAID 0+1 stripes the data across two disks and then duplicates that (min. 4 drives necessary) (It seems that there are different ways of combining these two, i.e. 0+1 and 1+0. Sometimes also called RAID 10. They're essentially the same, but they chang the order of things. RAID 0+1 would contain mirrors of stripes but 1+0 would be stripes of mirrors. Are these really different? That's something that hurts my head to think about. A few sources that I found maintained that they were different in the way the data is accessed and written.).

There are also other RAID types. The first list that I found was here.

If one of the drives goes bad, you ought to be able to continue running it from the RAID controller without problems until you replace the bad one. It wouldn't be a very good system for backing up your data if it failed to do so.

Compatability with non-RAID setups (i.e. what you said, unplug one drive from a RAID 1 and hook it up to a normal (non-RAID) controller channel) may vary across manufacturers. I really don't know whether this would work. Has anyone here tried it?
 

Turkey

Senior member
Jan 10, 2000
839
0
0
If you're in a RAID 1 array and one drive goes bad, the controller can usually detect it, then give some options like stop or keep going. When you plug another drive into the RAID array (in place of the one that went bad), the controller will rebuild the mirror on the new drive. If a drive in a RAID 0 setup goes bad, you are pretty much screwed.
 

bizmark

Banned
Feb 4, 2002
2,311
0
0


<< For raid 0 I take it that the drives have to be the same size...? >>



Yeah, the only RAIDs that I've ever seen have had perfectly identical drives. It'd prolly screw it up if the drives had different characteristics, i.e. size, sector size, rotation speed, # of platters and heads, etc.... if they were different, it'd be really hard to synchronize the reads/writes between the two drives. Maybe if you just had a Raid 1 it wouldn't matter as much. But I wouldn't be willing to try it. After all you're essentially throwing away space on the bigger drive.
 

azkiwi

Senior member
Oct 1, 2000
812
0
71
"If a drive in a RAID 0 setup goes bad, you are pretty much screwed. "

So RAID 0 is actually a 50% decrease in reliability, since you now have data loss if either of two drives develops a fault?

 

454Casull

Banned
Feb 19, 2002
254
0
0
You can stripe two unequal-sized drives, but you'll only get twice the capacity of the smaller drive. The other space is wasted.