Software RAID on Linux with mdadm

Now that we've completed our initial examination of the basics of RAID levels (including Nested RAID) it's time to turn our attention to RAID functionality on Linux using software. In this article we will be discussing mdadm -- the software RAID administration tool for Linux. It comes with virtually every Linux distribution and has some unique features that many hardware RAID cards don't.

RAID Controllers

We’ve spent a great deal of time examining various RAID levels such as RAID-0, 1, 5, and 6, and Nested RAID levels such as RAID-10, 50, 51, 61, and 60 or even the more complicated RAID-100 or RAID-160. In all of these discussions we have assumed there was a RAID “controller” that performed the various RAID operations. This includes sending chunks of data to the appropriate disks, computing parity, hot-swapping, disk fail-over, checking read transactions to determine if the read was successfully and if not, declaring that disk as “down”, plus other important tasks related to RAID. All of these tasks require some sort of computation and have to be performed by a RAID controller.

You really have two options for RAID controllers: (1) a dedicated RAID controller such as those on add-in RAID cards, (2) software RAID that uses the CPU for RAID chores. In the first case you have a dedicated RAID controller, typically on an add-in RAID card but it can be on a motherboard, that performs the necessary RAID computations. This controller typically uses a dedicated lower power processor, often a real-time processor such as a PowerPC, to perform the computations. Typically these controllers are put on an add-in card and you plug the drives you want in the RAID array into the card.

With software RAID, all the RAID functions run on the CPU. Pretty much all Linux distributions comes with software RAID in the form of md (Multiple Device) which is a driver within Linux that provides virtual devices created from one or more underlying devices (e.g. storage block devices). Plus the great thing is that it comes with almost all Linux distributions so you have access to the source (plus the price isn’t too bad either and it has a great deal of functionality). In addition, you can create Nested RAID configurations as needed since all RAID functions are in software (I smell a Triple Lindy coming).

One thing you have to be very careful about is what is commonly called a fakeRAID card or fakeRAID controller. FakeRAID is not hardware RAID because there is no dedicated RAID controller. Rather, they use a standard disk controller chip on an add-in card or motherboard, with some specialized firmware and drivers. At boot-time they run a special application that allows users to configure disks attached to the fakeRAID as a RAID group. But the RAID processing is really handled by the drivers which are run on the CPUs (so the CPU provides the computational power). Consequently, it’s really a software RAID solution and not hardware RAID (hence the name “fakeRAID”).

There is a great deal of discussion and grinding of teeth within the Linux community about fakeRAID. One point of the discussions is that the vendors of fakeRAID don’t tell customers that what they are actually buying is not a RAID card with a dedicated RAID controller, but rather a simple card with a disk controller coupled with drivers that use the CPU for RAID processing (false advertising). Plus there is the additional problem of developing and supporting drivers for Linux to allow these fakeRAID cards to be used. Moreover, there is a strong argument that it is probably better to use software RAID that comes with Linux (md) since it is already part of Linux and can arguably give you better performance.

However, if you want to use software RAID that comes with Linux in the kernel (md), you still need some tools to control/manage/monitor the software RAID arrays. That’s where mdadm comes in. This article will do a brief examination of mdadm and some of its options.

Introduction to mdadm

Mdadm is a software tool primarily written by Neil Brown that allows you to create, assemble, report on, grow, and monitor RAID arrays that use software RAID in Linux. Actually according to the documentation there are seven modes of operation:

  1. Create
  2. Assemble
  3. Follow or Monitor
  4. Build
  5. Grow
  6. Manage
  7. Misc

We’ll walk through these various modes of operation but the focus of this article is an introduction and not an in-depth HOWTO. You can find those types of articles on the web.

The first step in using mdadm, or any RAID for that matter, is to PLAN your RAID configuration carefully. Personally I like to work backwards starting with the purpose of the storage. Will it be used for a database? Will it be used for /home? Will it be used for high-speed scratch? Will it be used for data that requires a very high degree of reliability? Understanding the intent of the storage is really the key to creating the RAID configuration you need/want. Once you determine the storage use case, you need to develop an idea of how much I/O performance you need (throughput and IOPS) and the general ratio of read and write performance. You should also develop an idea of how much data redundancy you need for the storage.

Once you have an idea of the performance and redundancy of the array you can select the RAID configuration you think you might need. I would suggest you select a few candidate RAID configurations and then do some more reading/research on each one and select the RAID configuration that seems to be best. During this research be sure to examine the redundancy as well as the performance of the various RAID configurations and compare them to your estimations. But also be sure to examine the capacity and storage efficiency of each level. You may love the performance and storage efficiency of RAID-10 but the data redundancy may not be enough for you. Or you may love the data redundancy of RAID-61 but you may not willing to give up the performance or, perhaps more importantly, you may not be willing to have such low storage efficiency (especially if this is for your home system).

But just choosing the RAID configuration you want is not the end of your planning. You need to also consider a number of other things. Perhaps the most important thing you need to consider is if you will need to grow/shrink the storage. The reason this is important is because you are likely to have to use LVM (Logical Volume Manager) either on top of Linux software RAID or underneath it. This forces you to carefully consider how to build both LVM and software RAID and how you expand either one or both. I would recommend walking through the expansion steps to make sure you understand how to do it (you could even pass along your ideas to someone else to have another pair of eyes examine them).

One other thing you should consider before implementing your well formulated and thought-out RAID plan is the file system that sits on top of the storage. Based on your usage model for the storage, select one or two candidate file systems. Then do some research on each one to find out what problems or limitations exist, and also how you can optimize each file system for better performance (we’re all performance junkies at heart). There are a number of articles on the web that discuss tuning file systems with Linux software RAID.

Assuming that you have done your careful planning (including a backup solution), let’s move on to the first “mode” of mdadm, Creating a RAID array.

Creating a RAID array

Mdadm allows you to create a RAID array using Linux block devices. During the creation of the array, per-device superblocks are created for the RAID array (allows for the array to be assembled correctly). Using the “create” mode is the most common method for building the array and is recommended if you are just starting to use mdadm.

The basic mdadm command for creating a RAID array is fairly simple with the following generic command and typical options.

mdadm --create [md-device] --chunk=X --level=Y --raid-devices=Z [devices]

where the options are as follows:

    -c, –chunk= Specify chunk size in kibibytes. The default is 64.

    -l, –level= Set raid level, options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4, raid5, 5, raid6, 6, raid10, 10, multipath, mp, faulty

    -n, –raid-devices= Specify the number of active devices in the array.

Comments on "Software RAID on Linux with mdadm"

I am truly thankful to the owner off thks site who hass
shared this enormous post at at this place.

my site :: car insurance cheap

I’m not sure wwhy but this blog is loading
incredibly slow for me. Is anyokne eelse having this problem or is iit a problem on my end?

I’ll check back later and see if the problem still exists.

My page – cheap full coverage car insurance

Unquestionably imagine that which you said. Your favorite justification seemed to
be at the web the easiest thing to understand of. I say to you,
I certainly get irked at the same time as people think about issues
that they just do not recognise about. You controlled to hit the nail upon the top
and also defined out the whole thing with no need side-effects ,
other folks could take a signal. Will likely be back to get more.
Thank you

My homepage :: cheap car insurance

It’s awesome too pay a quick visit this website and reading the views of all colleagues concerning this piece of writing,
while I am also zealous of getting knowledge.

Also visit my web-site cheap car insurance in ohio

Greetings from Colorado! I’m bopred to tears at work soo I decided to browse your website on my
iphone during lunch break. I enjoy the info you present here and can’t wait to take a look when I
gett home.I’m surprised at how quick your blog lkaded on my
phone .. I’m not even using WIFI, just 3G .. Anyways, fantastic blog!

My blog – Cheap Car Insurance

My partner and I stumbled over here coming from a different web address and thought I may as well check things out.
I like what I see so now i am following you. Look forward to going over your web page yet again.

Look into my web site – cheap liability car insurance

I have read so many articles regarding the blogger lovers except this paragraph
is genuinely a nice article, keep it up.

Also visit my website list of car insurance companies

Everything wrote made a bunch of sense. However, think about this, suppos you added a little content?
I amm not suggesting your informatrion isn’t solid, however what iif you added a title that makes people
desire more? I mean Software RAID on Lihux with mdadm | linuxdlsazine is a little vanilla.
You ought to look at Yahoo’s home page and see how
they create article headlines to grab viewers
interested. You might add a video orr a picture or two to grab people excited about everything’ve written.
Just my opinion, it might make your blog a little livelier.

Have a look at my web-site – cheap liability car insurance

I really like your blog.. vrry nice colors & theme. Did you make this
website yourself or did you hire someone to
do it foor you? Plz reply as I’m looking to design my own blog and would like to find out where u got this
from. appreciate it

my webpage; very cheap car insurance

Hi, I do think this is an excellent site.
I stumbledupon it ;) I may revisit onche again since
I bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue tto guide
other people.

Also visit my web site; cheap car insurance in ny

Hmm is anyone else experiencing problems with the images
on this blog loading? I’m trying to determine if its a problem on my end or if it’s the blog.
Any responses would be greatly appreciated.

Feel free to surf to my blog: car insurance companies

I like what you guys are usually up too. Such clever work and
reporting! Keep up tthe fantastic works guys I’ve incorporated you guys to
mmy personal blogroll.

Look at my weblog – cheap car insurance

Saved as a favorite, I like your website!

Visit my web site Cheap Car Insurance

Thanks for sharing your thoughts. I really appreciate your efforts and I am waiting for your further
write ups thank you once again.

my page :: cheap car insurance california

Thank you ever so for you article.Much thanks again. Keep writing.

Check below, are some completely unrelated web-sites to ours, nonetheless, they’re most trustworthy sources that we use.

Thanks-a-mundo for the article post.Thanks Again. Will read on…

Although internet websites we backlink to below are considerably not connected to ours, we feel they are really really worth a go by way of, so possess a look.

Leave a Reply