LVM? DM-RAID? Both? None?

Submitted by gwolf on Sat, 09/17/2011 - 13:06

Patrick tells about his experience moving from LVM to RAID.Now, why do this? I have two machines set up with LVM-based mirroring, and they work like a charm - I even think they work with better flexibility than setting it up in a RAID-controlled way, as each of the partitions in a volume group can be easily set to use (or stop using) the mirroring independently, and the requisite of having similar devices (regarding size) also disappears. Of course, this flexibility allows you to do very stupid things (such as setting up a mirror on two areas of the same rotational device - Good for toying around, but of course, never to be considered for production). And the ability to online grow and shrink partitions is just great.

So, Patrick, fellow readers, dear lazyweb, why would you prefer LVM-based mirroring to a RAID alternative? Or the other way around?

( categories: )
Zolin's picture

HW RAID does not cost cpu cycles...

The main reason to use HW RAID instead of SW RAID because HW RAID is normally faster SW RAID, besides it will not penalize the CPU for the Mirroring of the devices, and will restrict the user of shooting himself on a foot by doing mirror within the same device :). That is good to learn but as you said, not good for production, but there are people that if you give them the chance will do it that way.
Cheers!

gwolf's picture

Of course, the question is not HW versus SW RAID...

Given you have HW RAID, it's probaby the best alternative to use it. It's not for every use case, though. If you have a dedicated storage server, you can easily devote its CPU to the (small for a modern CPU) load it will mean. Or if you don't have the resources for a RAID-enabled server, or grew organically from a smaller server, you can have almost-the-best for much less money.

Jeff Epler's picture

I chose lvm inside raid…

…primarily so that I could have RAID5 (2x storage + redundancy with 3 spindles). As far as I am aware, using LVM only offers RAID10 (2x storage + redundancy require 4 spindles, a cost increase of ⅓). However, I use small partitions so that any one filesystem fits on a single piece of backup media (DAT160), so I want the flexibility to create and resize partitions, which is the strength of LVM.

gwolf's picture

According to some resources I've read...

Although mostly database-oriented, although RAID5 does give you the least space consumption while giving you assurance your information stays complete, it is the slowest, as all operations must be carried out on all of the array's disks at once. A RAID10 (that is, a RAID1 on top of a RAID0) seems to be the favored solution.

XANi's picture

Definitely both. software

Definitely both. software RAID is much more tested, LVM have some fails: http://deranfangvomende.wordpress.com/2011/04/04/linux-lvm-mirroring-com.... Altho some of that was fixed, I'd still rather have some kind of RAID + LVM on top of that just to divide that space into volumes than use only LVM

gwolf's picture

Thanks for the pointer!

Interesting... So, yes, if you are setting up a disk array for serious job, it sounds RAID (even software-) is better suited for the reliability facet than LVM.

I'll look a bit deeper into this. I'm expecting a new server to arrive soonish (whatever that means...), so I'll probably make a RAID1 out of its disks.

Now, the convenience of LVM for administration is still too much to ignore. So, most probably, I'll do LVM over RAID.

Thanks a lot!

Patrick's picture

LVM mirroring

Hey Gunnar,
yes, I also thought about using LVM mirroring, but some sites suggested that it only makes sense with 3 disks. As I had no experience with it myself and were to lazy to do it, I decided to stick with something I know.
Greets
Patrick

cerber0's picture

May be MIX both technologies

When the cost is not an issue,

I have a customer that use an interesting mix of both technologies.

The customer have the OS installed in a local disk, and LVM mirrored with a SAN disk (R5 7D+1P).

The interesting thing is that the customer can use all capabilities of enterprise Storage, In this case, the customer can replicate the OS to DRP site.