Skip to content

            Lost ?  |  Need an account:
 
Linux RAID How-to PDF Print E-mail
(5 votes, average 4.40 out of 5)
Written by Tom Hirt   
Thursday, 04 June 2009 14:07
Article Index
Linux RAID How-to
Configuring RAID
All Pages

 

Linux RAID Overview


In this KB, we are going to show you how to create a software RAID device in Linux.  It's important to note that we will only cover software RAID devices in this KB and will be using the term "RAID device" to infer software RAID and not hardware.

RAID stands for Redundant Array of Inexpensive Disks.  RAID was originally introduced as a way of gaining higher availability and redundancy by eliminating a single point of failure with the loss of a single volume/disk.  Since its introduction, RAID has grown in popularity and today is widely used throughout the enterprise.  For example, most SAN (storage array networks) technologies utilize a combination of hardware and software RAID techniques to present volumes or LUNs to hosts.

RAID devices provide a means of achieving higher availability by "mirroring" or copying data to multiple disks.  When data is written to the disk, RAID instructs the system to write multiple copies of the data on different disks to prevent data loss should a drive fail.

RAID can not only increase your disk's availability, but it can also achieve higher I/O throughput.  "Striping", allows you to overcome the limitations of a single disk's I/O.  RAID stripes allows you to aggregate the bandwidth of several disks by writing blocks of data horizontally across the array spreading the I/O out evenly amongst the members of the array.

Depending on your particular need, you may opt for speed, redundancy or a combination.  The different levels of RAID provide varying levels of speed and redundancy, so you can choose the setting that is right for you. Software RAID in Linux supports 7 different modes:

  • Linear - Disks are appended to one another to form a larger device.  There is no striping or redundancy in linear mode.  The system simply treats the disks like an aggregate of disks, which spills over from one disk to the next as they fill up.

    Linear Raid

  • RAID 0 - Is striping mode.  In a RAID 0 configuration, read and writes are done in parallel to all the members of the array.  Blocks of data written to the array are broken down into smaller chucks and written simultaneously to all members of the array.  The same is true with reads (but in reverse), chunks of data are simultaneously fetched from the different members of the array and assembled to build the block.  RAID 0 provides the greatest I/O but lacks redundancy.  A single drive loss in the array will corrupt the data on all the remaining volumes so use with caution.

    Raid 0

  • RAID 1 - Is mirroring mode.  In a RAID 1 configuration, data is mirrored between 1 or more volumes.  RAID 1 provides the highest level of availability offered in RAID, however because of the redundancy, it is also the slowest.  Because each drive contains a full copy of the data, you can loose multiple drives in the array (up-to N-1 failures) and continue to operate without a hiccup.  It should go without saying that RAID 1 also uses a significant amount of storage since multiple copies of data are stored in multiple locations.  It's also important to note that RAID 1 has very fast read times due to is ability to load-balance read requests amongst the members of the array.

    Raid 1

  • RAID 4 - Is striping with parity.  In a RAID 4 configuration, data is striped across the members of the array (similar to RAID 0) however parity information is also calculated providing the ability to recover from the loss of a single disk.  The redundancy of RAID 4 comes with a cost of N-1 in storage to the array (since one disk is used for parity, the total capacity of the array is reduced by 1.)  RAID 4, like RAID 0, generally provides better I/O performance since read/writes are done in parallel.  However, RAID 4 is seldom used because of the bottleneck caused by the parity disk.  Since each I/O write requires the parity information to be updated on the parity disk, the total throughput of the array can be limited by the I/O of the parity disk (Use RAID 5 instead of RAID 4.)

    Raid 4

  • RAID 5 - Is also known as striping with parity and very similar to RAID 4.  However in a RAID 5 configuration, the parity information is spread evenly across all the disks in the array eliminating the bottleneck of the RAID 4 parity disk.  RAID 5 offers all the features of RAID 4 but without the bottleneck of the parity disk.  Therefore, RAID 5 offers a better solution for speed with redundancy compared to that of RAID 4, but not quite the speed of Linux RAID 10.

    Raid 5

  • RAID 6 - Is striping with dual distributed parity.  RAID 6 works the same as RAID 5 however with dual parity.  Although less common, the additional parity information allows up-to two simultaneous disk failures of an array without data loss.  Dual parity eliminates the risk associated during the rebuild process of a RAID 5 array.  On a RAID 5 array, should another disk fail during the rebuild process, the array will be lost.  Since RAID 6 can sustain multiple drive losses within the array, the loss of a single disk does not pose a risk of data loss should another disk fail during the rebuild.  However, the added redundancy comes at a cost both in capacity and performance.  RAID 6 requires a minimum of 4 drives in the array with the total capacity reduced by N-2.  Also, because of the dual parity, write speeds can take significantly longer than that of RAID 5.

    Raid 6

  • RAID 10 (available in kernel v.2.6.9 and greater) could probably warrant an article all of it's own but I'll try and sum it up briefly so we can move on to the configurations.  Linux RAID 10, aka MD (multiple disk) RAID 10 can be configured in "near" or "far" configurations depending on the number of disks available in the array.   Near configurations are built from a odd number of disks and are more similar to that of RAID 1, while far configurations require even number of disks and are more similar to that of RAID 0 (the far configuration provides better performance than that of the near configuration.)  Linux MD RAID 10 should not be confused with RAID 1+0 (combination RAID levels).  MD RAID 10 in a far configuration (even number of disks in the array) will have performance characteristics similar to that of RAID 0 for reading, but half the speed for writing.  Therefore generally speaking, RAID 10 offers better performance than that of RAID 5 however comes at a total cost in capacity of N/2.

    Raid 10

Now that we know a little more about the different RAID levels, lets begin with our configuration.

 



Comments
Add New Search
Adrian Bradshaw  - /etc/mdadm.conf |06/07/2009 04:53:58
Hi

Firstly thanks for this series of articles - they are really superb and have helped me understand a lot more about RAID and LVM on Linux

One think that I am a little confused about is your reference to /etc/mdadm.conf - I have worked through these articles and while I dont have a /etc/mdadm.conf the RAID does start and /etc/fstab mounts it on each reboot

Do you know if this is just my distribution ? Centos 5.3

Thanks again, Adrian :D
thirt |07/07/2009 12:15:33
Hi Adrian,

Thanks for the feedback.

Very interesting, when I wrote this article, I was working from a RHEL 5 system. I would think CentOS being such a close relative of Red Hat EL would function much the same way.

A couple things you can check. Look at the man page for mdadm, (man mdadm & man mdadm.conf). Within the man page, there should be a section entitled “FILES”. The FILES section should describe the different configuration files used by mdadm. Cent’s release of mdadm might make use a configuration file located under a different directory structure.

Also, I have seen some distributions use /etc/mdadm/mdadm.conf. I’m not entirely sure of Cent’s preferred location, but the man page for mdadm should certainly clue you in.

You might also take a look at the RPM package. Often times, looking at the files which makeup the RPM will clue you into the files used by the package. A ‘rpm –ql mdadm’ should list all the files contained in the RPM for mdadm. You might see the configuration files listed in there as well.

If all else fails, try a ‘locate mdadm.conf’ and see what that turns up.

Also, I’m surprised to hear the device automatically mounts. After you created the device, did you define it within /etc/fstab or did mdadm take care of the addition for you?

Let me know what you find. If I get sometime this week, I’ll fire up a copy of CentOS myself and take a look if you haven’t figured
it out.

Best
-Tom
Adrian Bradshaw  - /etc/mdadm.conf - seems its optional |11/07/2009 03:02:37
Hi Tom, thanks for getting back to me. I took your advice and it seems that /etc/mdadm.com is optional these days - its certainly best practice to use it but it wont hurt if you dont

Here is a quote from about half way down http://linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html

Quote:
Unlike /etc/raidtab, mdadm does not rely on /etc/mdadm.conf to create or manage arrays. Rather, mdadm.conf is simply an extra way of keeping track of software RAIDs. Using a configuration file with mdadm is useful, but not required.


Anyway, keep up the great work - this is a great site
Joe |05/08/2009 15:42:40
This is a nice tutorial, thank you. When you discuss the mdadm.conf file, you do not mention UUIDs. Which is the preferred syntax?
thirt |22/08/2009 20:22:05
Hi Joe,

Excellent question. It really depends on your environment. I probably should have included a section on UUID’s in here (perhaps I’ll go back this weekend and update this article.) But to answer your question, for a system with only a few disks and/or a single array, using the UUID probably isn’t necessary (as you’ll know which disks belong to the array.) But for a system with multiple arrays and many disks, remember which disks belongs to which array can become difficult. For these systems, you’ll probably want to use the UUID.

Hope this answers your question!

Best,
Tom
Deepak Kumar |04/03/2010 07:19:21
hi........
i think fd will be used insted of fb in Hex code ..


Deepak Kumar
zishan  - raid 6 |13/09/2010 06:05:11
i have configured raid 5 in rhel 5.0
i want to confirm that can i configure raid 6 in rhel 5.3.
do i have to install any rpm to configure raid 6.
plz help to know it
Rashid Iqbal |17/09/2010 06:53:59
After configuring the software raid-1 on running system
but after restarting the system after configuring the software RAID-1 I receive the below error:
error 15 the file cannot be found
I restart the system into rescue mode but their the system cannot mount the harddisk devices under the /mnt/sysimage

kindly help me to sort out this problem
Biswajit  - Openoffice install to linux5.3 |12/01/2011 01:45:28
how to install or configure Openoffice in linux5.3.
which OPenoffice software support for linux5.3.
Plz link provide.
thk for help
Ravi kant sharma  - not wrking |14/03/2011 13:45:37
hiiiii.......
to create raid device- mkraid /dev/md0 is not wrking in RHEL 5.3 so wat shud i do.....?????????
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:D:):(:0:shock::confused:8):lol::x:P:oops::cry::evil::twisted::roll::wink::!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

Last Updated on Thursday, 18 June 2009 14:59
 

Forum Activity

Author:
Author: kenny22
Jan.24.12
Author: AaronRiley
Jan.15.12

Online Stats

Guests Online: 81
Members Online: 0