You are not logged in.

#1 2009-12-02 22:42:27

kfour
Member
From: chicago
Registered: 2009-07-15
Posts: 5
Website

LVM, Raid 5 and growing arrays

I'm having a difficult time really understanding what LVM is and why I need it with my raid array.
From the wiki on LVM:

With LVM you can use all your storage space as one big disk (volume group) and have more flexibility over your partitions (logical volumes).

Ok, but heres the thing...I used mdadm to create a raid array which now shows up at /dev/md0..theres my "one big disk". As far as flexibility over partitions, do I need LVM if I want to grow my array? Just playing around in a VM adding and failing HDDs has shown me it isnt too difficult to grow the array. Am I going to regret not using LVM in the future?

Thanks for the help.

Offline

#2 2009-12-02 23:24:35

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: LVM, Raid 5 and growing arrays

One comment from googling is that LVM cannot be used with a boot raid array.

A quote from googling defines a use of LVM with an existing raid array:

Initial set of LVM on top of RAID
Now that we have /dev/md0 device you can create a Logical Volume on top of it. Why would you want to do that? If I were to build an ext3 filesystem on top of the RAID device and someday wanted to increase it's capacity I wouldn't be able to do that without backing up the data, building a new RAID array and restoring my data. Using LVM allows me to expand (or contract) the size of the filesystem without disturbing the existing data.

Anyway, here are the steps to then add this RAID array to the LVM system. The first command pvcreate will "initialize a disk or partition for use by LVM". The second command vgcreate will then create the Volume Group, in my case I called it lvm-raid:

http://www.gagme.com/greg/linux/raid-lvm.php


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#3 2009-12-03 12:06:17

Mikko777
Member
From: Suomi, Finland
Registered: 2006-10-30
Posts: 837

Re: LVM, Raid 5 and growing arrays

Well guess if you only want to grow the arrays lvm wont be needed.

My understanding was that lvm is needed to shrink/ grow/ modify etc the partitions inside the array(s).

Offline

#4 2009-12-03 18:53:50

nogoma
Member
From: Cranston, RI
Registered: 2006-03-01
Posts: 217

Re: LVM, Raid 5 and growing arrays

I use LVM-on-RAID, but I think of the layers as:
RAID - do fancy stuff like mirroring/striping/etc. for performance + security
LVM - make my life easier when it comes to allocating diskspace

That is, I usually put the LVM on top of RAID, giving all of the RAID device to LVM as a physical volume and volume group, and then allocate only what I currently need for my system into logical volumes (for /, /home, etc.). I might not originally have had a separate /var/ partition, but then realize it'd be cool to try it out on another filesystem to improve pacman performance, at which point I can create a new logical volume and mount that as /var/. Then, when I realize that there's an even *better* filesystem out there (as there inevitably is), I can simply create another logical volume with the new filesystem (assuming I still have space in my volume group), sync the stuff over from my old var, and mount the new one as /var/. Once I'm satisfied that the new /var/ is good and performs better, I can delete the old logical volume and reclaim the space. So, LVM to me is more about flexibility with my filesystems/mountpoints and not having to worry about fiddling the partition table and blowing stuff up.

If you're mainly concerned with growing RAID arrays, you can probably skip LVM; the way I use LVM, you'd have to grow the RAID array under LVM first, anyway.


-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/

Offline

Board footer

Powered by FluxBB