dcsimg

Pick Your Pleasure: RAID-0 mdadm Striping or LVM Striping?

A fairly common Linux storage question: Which is better for data striping, RAID-0 or LVM? Let's take a look at these two tools and see how they perform data striping tasks.

Given the price of hard drives and the number of drives you can put into a single system albeit a desktop or a server, a very common question is how to arrange the drives to improve performance. Consequently, a somewhat commonly asked Linux storage question that you see on various mailing lists is, which is better for data striping, RAID-0 with mdadm or LVM? While many people will correctly point out that this argument is somewhat pointless because each is really intended for different tasks, the question is still fairly common. Nonetheless, in the quest for the best performance possible, there is still the question of which one is better (whether it’s meaningless or not). In this article both concepts will be contrasted in regard to performance with some discussion about appropriateness. To add at least a little chaos to the situation, some simple IOzone benchmarks with RAID-0 and LVM will be presented.

Data Striping

Data striping is a commonly used technique for improving performance. It breaks data into pieces that are assigned to various physical devices, usually storage devices, in a round-robin fashion. One of the reasons that this concept was developed is that processors are capable of generating IO (reads and writes) much faster than the storage device can store or recall it. But if you can split the data among multiple storage devices then you can perhaps improve IO performance.

The process is very simple. In the case of a write function, the incoming data is split into pieces with the first piece being sent to the first device, the second piece being sent to the second device, and so on until all the devices have received a data piece or all the data has been written. If there are still pieces of data to be written then the next piece is sent to the first device and the process continues (round-robin). Data throughput is improved because the system can send one piece of data to one storage device and immediately move on to the next piece of data and the next storage device without having to wait for the first one to complete. If you like, the data storage is parallelized. In Linux there are two primary ways to achieve this, RAID-0 and LVM.

RAID-0 with mdadm

One way to achieve data striping is to use RAID-0. Most people are probably familiar with the concept of RAID (Redundant Array of Inexpensive Disks) that seeks to divide data, possibly replicate it, and place it on storage devices. There are various techniques to achieve these goals and each one has a number associated with them such as RAID-0 or RAID-1. These details of the scheme define whether the emphasis is on either data reliability or increased throughput or possibly both.

RAID-0 is a scheme to improve data throughput by taking the data and spliting it evenly between multiple disks (data striping). Figure 1 below, from Wikipedia, shows how data is split across two disks.

RAID_0.png
Figure 1 – Diagram of RAID-0 layout of Two Drives

In this example, the first data piece, A1, is sent to disk 0, the second piece, A2, is sent to disk 1, and so on.

There are two terms that help define the properties of RAID-0.


  • Stripe Width
    This is the number of stripes that can be read to or written from, at the same time. Very simply, this is the number of drives used in the RAID-0 group. In example 1 the stripe width is 2.
  • Stripe Size
    The phrase refers to the size of the stripes on each drive. The phrases block size, chunk size, stripe length or granularity will sometimes be used in place of stripe size but they are all equivalent.

RAID-0 can, in many cases, help IO performance because of the data striping (parallelism). If the data is smaller than the stripe size (chunk size) then it will be written to only one disk not taking advantage of the striping. But if the data size is greater than the stripe size, then read/write performance should increase because of the ability to use more than one disk for a read or write. Increasing the stripe width adds more disks and can improve read/write performance if the stripe width (chunk size) is greater than the data size.

Mdadm (pronounced “m-d-adam”) is a tool for Linux for managing software RAID devices in Linux. It has seven modes of operation that pretty much cover any possible task you might use software RAID.


  • Assemble
  • Build
  • Create
  • Monitor
  • Grow
  • Manage
  • Misc

Mdadm is an all-purpose RAID management tool for Linux with a long history.

LVM Striping

LVM has been discussed in a previous article about managing pools of data. As discussed, it is an extraordinary useful tool for managing storage. Fundamentally it allows you to collect physical storage devices and combine them into virtual devices (volume groups) that can be divided into logical partitions (logical volumes) that are then used as the device for file systems. You can add or subtract devices from the virtual devices (volume group) or even move them as needed. Coupling these techniques with file systems that can be resized and you have a terribly efficient way of growing or moving file systems as needed.

In addition, LVM is very flexible allowing you to control exactly how the physical devices are combined into the volume groups (VGs) and the logical volumes (LVs). It is this flexibility that allows you to do data striping. In LVM this is called striped mapping. Figure 2 below illustrates this concept.

striped_mapping.png
Figure 2 – Striped Mapping in LVM

Striped mapping maps the physical volumes (typically the drives) to the logical volume that is then used as the basis of the file system. LVM takes the first few stripes from the first physical volume (PV0) and maps them to the first stripes on the logical volume (LV0). Then it takes the first few stripes from the next physical volume (PV1) and maps them to the next stripes in LV0. The next stripes are taken from PV0 and mapped to LV0 and so on until the stripes on PV0 and PV1 are all allocated to the logical volume, LV0.

The advantage of the striped mapping is similar to RAID-0. When data is read from or written to the file system and if the data is large enough, it spans multiple stripes so that both physical devices can be used, improving performance.

Contrasting RAID-0 and LVM

From the previous discussions it is obvious that both RAID-0 and LVM achieve improved performance because of data striping across multiple storage devices. So in that respect they are the same. However, LVM and RAID are used for different purposes, and in many cases are used together. Let’s look at both techniques from different perspectives.

The size (capacity) of a RAID-0 group is computed from the smallest disk size among the disks in the group, multiplied by the number of drives in the group. For example, if you have two drives where one drive is 250GB in size and the second drive is 200GB, then the RAID-0 group is 400GB in size, not 450GB. So RAID-0 does not allow you to use the entire space of each drive if they are different sizes.

On the other hand, LVM allows you to combine all of the space in all of the drives into a single virtual space. You can use stripe mapping across the drives as you would in RAID-0, with the capacity being the same as RAID-0. However, LVM allows you to also use the remaining space for additional volume groups (VGs).

In the case of mdadm and software RAID-0 on Linux, you cannot grow a RAID-0 group. You can only grow a RAID-1, RAID-5, or RAID-6 array. This means that you can’t add drives to an existing RAID-0 group without having to rebuild the entire RAID group but having to restore all the data from a backup.

However, with LVM you can easily grow a logical volume. But, you cannot use stripe mapping to add a drive to an existing striped logical volume because you can’t interleave the existing stripes with the new stripes. This link explains it fairly concisely.

“In LVM 2, striped LVs can be extended by concatenating another set of devices onto the end of the first set. So you can get into a situation where your LV is a 2 stripe set concatenated with a linear set concatenated with a 4 stripe set.”

Despite not being able to maintain a striped mapping in LVM, you can easily add space to a strpped logical volume.

This article, written by the original developers of LVM for Linux, present four advantages of LVM.



  1. Logical volumes can be resized while they are mounted and accessible by the database or file system, removing the downtime associated with adding or deleting storage from a Linux server
  2. Data from one (potentially faulty or damaged) physical device may be relocated to another device that is newer, faster or more resilient, while the original volume remains online and accessible
  3. Logical volumes can be constructed by aggregating physical devices to increase performance (via disk striping) or redundancy (via disk mirroring and I/O multipathing)
  4. Logical volume snapshots can be created to represent the exact state of the volume at a certain point-in-time, allowing accurate backups to proceed simultaneously with regular system operation

These four advantages point to the fact that LVM is designed for ease of management rather than performance.

Performance Comparison of RAID-0 and LVM Striped Mapping

Comments on "Pick Your Pleasure: RAID-0 mdadm Striping or LVM Striping?"

If you’re involved of your coronary heart well being then,
yoou cann make the most of LIfeTrak C200 Core.

Here iis mmy web-site – Escorts in Southampton

you are actually a good webmaster. The web site loading velocity is amazing.
It sort of feels that you are doing any unique trick.

Furthermore, The contents are masterwork. you’ve done a great process in this matter!

Great information. Lucky me I found your website by chance (stumbleupon).

I have saved it for later!

Here is my homepage cialis online canada

Outstanding post however , I was wanting to
know if you could write a litte more on this topic? I’d be very thankful if you
could elaborate a little bit more. Thanks!

Hi there, just became alert to your blog through Google,
and found that it is truly informative. I’m gonna watch out for brussels.
I’ll appreciate if you continue this in future. A lot of
people will bbe benefited from your writing. Cheers!

My website dyson dc56

This design is incredible! You obviously know how to keep a reader
amused. Between your wit and your videos, I was
almost moved to start my own blog (well, almost…HaHa!) Great job.
I really loved what you had to say, and more than that, how you presented
it. Too cool!

Have a look at my blog post – dyson dc59

Fitbit CFO Bill Zerellaa told the Fool during a cellphone interview onn the day of the IPO that thee company will not
be worried about opponents.

Heere is my blog post :: Mitzi

Not like the Charge, the HR is armed with a heart
charge monitor and a different strap tha it is fitness monitoring twin.

Also visit my web page: plumber goes

This page definitely has all of the information I wanted concerning this subject and didn’t know who
to ask.

Set a purpose and watch your progress, get notifications whesn you couuld
hhave achieved targets, and receive encouragement to stay on track.

my web blog :: proposed plumbers

Usse the Loop with a cellphone app like Endomondo for GPS monitoring and
you’ve got every basee lined on activity tracking annd
analysis.

My blog plumbers in southampton

The top product is a weekly/month-to-month report that gives a personalized health
plan as well as nutritional objectives.

Feel free to visit my homepage – Janina

PharmaEurope.net sells real legit anabol?c st?roids.
?ll their stuff iis authentic and of very ?igh quality –
here you cann b?y testosterone, anadrol, trenbolone, human gro?th
hormone,cyt?mel, T3, and more without prescription

Get extra nutritional information, the best train packages, health motivation and a FREE book with
over 100 iideas for dropping belly fat here.

Also visit my web-site :: plumbers near me

The accuracy of collected data will be differ because the calculations are based mostly on generic values for age, height, weight and sex.

Also visit my page Robby

The Fitbit Drive leaps to the top of the health tracker heap, with
a vibrant screen, comfy fit, and a bevy off slick options.

Also visit my webpage :: Noelia

A garden mower is sort of essential if you want to hold your yard looking lush and exquisite.
Mowing the garden is actually an important process if you want to preserve
your garden trying enticing all via the year.
A good wanting garden is not going to only enhance the aesthetics
of your property, however it is going to also increase its’ resale worth.
There are principally two forms of mowers, namely; electric garden mowers and petrol lawn mowers.

Just give me a tten dollar pedometer from K Mart and a free heazlth app corresponding to My Fitness Pal or Endomondo.

my web site – Chelsea

Notably, the Jawbone UP24, Nike FuelBand SE, and Fitbit One will
sync commonly and routinely.

Here is my web page :: bands for hire

You can tap thhe face of it throughout the dayy to see your progrews , and it
serves as a atch as properly—albeit a moderately abstract one.

Also visit my homepage :: hire a band

You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand.
It seems too complicated and very broad for me. I’m looking forward for your next
post, I’ll try to get the hang of it!

Coordintion is the power to get your muscles and your sensees to work collectively easilly and effectively to accomplish a task.

Also viusit my site; plumbers near me

Zuma dance exercises for hwalth are enjoyable and ann
effective way to burn these calories.

My blog – occasions plumbing contractors

Does your website have a contact page? I’m having a tough time locating it but, I’d like to shoot you an e-mail.

I’ve got some creative ideas for your blog you might be interested in hearing.
Either way, great blog and I look forward to seeing it develop over time.

Clash Royale is the very first portrait-style game from
Supercell with super addicting gameplay and strategic
yet easy interface.

It aiuds your general health targets annd wewll being by exhibiting
your accurate weight, BMI, and physique fat
percentages.

My web page … plumbers in southampton

“Fantastic blog post.Much thanks again. Fantastic.”

Attractive section of content. I just stumbled
upon your web site and in accession capital to assert that I acquire
in fact enjoyed account your blog posts. Anyway I’ll be subscribing
to your feeds and even I achievement you access consistently rapidly.

Leave a Reply