Using RAID in Linux - page 4

The Mysteries of RAID

August 1, 2002

By
Alexander Prohorenko

Linux supports these RAID levels very well. It also supports their
combinations, for example, the popular 0+1, which sometimes can be
called RAID 10. Also, there is Linear-mode--also known as "paritioned volumes."

We should mention there are a lot of different pieces of literature
and documentation about the different RAID levels, so we will browse
them only briefly.

Linear-mode. Some would argue that this is not true RAID, because
there is no "redundancy." In this mode the crash of any drive will
destroy the whole array. It is used for the unification of small
paritions of disks into one big-sized partition. Sometimes it can increase
productivity. For example, when we have a lot of small files, with
the ext2 file system trying to place them all over the partition,
and of course, the files are all going to different
disks. Good choice for news servers and other servers with similar
functionality.

RAID 0. Again, nothing impressive about reliability. It's a classic
"fast" RAID--speed, speed, and more speed, especially with
reading/writing big data streams. Of
course, this is done at the expense of reliability. It's similar to
Linear-mode, but paritions are separated by (so-named) stripes or
chunks, which will later be uniformly placed on devices included in
array. The best choice for big database files, multimedia, streaming
video, and so on. With medium file sizes and medium size chunks, we
will see almost no effect.

RAID 1. Famous and very popular since the advent of Novell NetWare
"mirrors." Two and more partitions
of same size--information will be mirrored to each other. This is
the first of "reliable" RAID levels, which achieved because of the
accuracy of keeping information, which is about 100% * (N -
1), where N is number of disks in array. When one fails (or
even a few of them, if N > 2), it's usually possible to work
with the others. RAID Linux drivers can balance the top-level load
on reading, separating requests to other "mirrors."
Sometimes this helps to increase the speed of reading by almost N
times. During writing, RAID 1 usually slows down because the same
information could be copied on multiple disks at once. It happens
that sometimes productivity of writing could be N times worse
than with just one disk. RAID 10 in reality is just Linux using two or more
RAID 0 arrays combined into a single RAID 1. This is possible
because the RAID-array can be treated just like a normal block
device or hard disk. Everything you can do with a disk, you see, you
can do with an array. So, RAID 10 appears to be a good option when you have
a lot of disks and controllers.

RAID 4. It's much like RAID 5, but the reliability is worse. As such
, it's not popular, since anyone learning twoard the relable end of
the RAID spectrum is just as likely to "bump up" to RAID 5. Any
additional information you can find in documentation files.

RAID 5. Neutral in many cases. It supports the necessary reliability
in cases of disk crash and supports rather good speed for
reading/writing an is very economical on disk space. Total disk
space equals (N - 1) * S, where N is the number
of disks and S is the size of one partition. Be sure not to
use RAID 5 if your the number of disks is less than three--such a
configuration doesn't have any advantages over RAID 1. You'll just
get "dummy" productivity and problems during recovery. RAID 5 is
created with a number of chunks like in RAID 0, but part of these
chunks consist of odd data blocks uniformly on all of the existing
partition of the array. In the case some disk crashes, the array
continue to work, however with less speed. And information from the broken
disk will be restored according of contents of odd blocks. By adding
a spare disk, information can be reconstructed and the workability
of the array will be fully restored. It goes without saying that
there is a way to do all that "on the fly" without turning off
system. However, because it is necessary to reorganize all odd data
blocks, it's impossible to change the size of an existing RAID 5
array without removing all data on it. It is possible to support
more reliability--for example, organizing RAID 5 over three
three-disk RAID 5 arrays, which supports workability
in the case of a simultaneous crash of any of the three disks. And
so on. Of course, relability can always be improved by losing
additional disk space.