Posted: Wed May 01, 2002 3:38 pm Post subject: I have a question about the usage of LVM...

This is going to be a stupid question probably, but as my mother always used to say... there are no stupid questions, just stupid people.

I've heard alot about LVM recently, in docs/this forum/kernel code, etc... and with Win2K although I'm wondering if it's the same thing. I'm kinda mystified about LVM, and what it's used for, it's practical purpose, etc...

I'd love to try it out just to see what it's all about, but you know any insight would be great!

EDIT: A bit more information; LVM and the Windows-equivalent run at a software level, rather than a hardware level. Because of that, you have to have the OS running in order to take advantage of the logical volumes.

Now, LVM, as I understand it, still uses ext2 or similar file systems, so I'm not sure if you can still read the raw partition from another OS. This wouldn't work from a Windows box, since W2K can't read ext2fs, but it might work from a Linux box sine Linux can read NTFS.

So, to amend my previous answer; most assuredly not at the logical volume level, but perhaps it *might* work at the raw partition level.

--kurt_________________The problem with political jokes is that they get elected

Thanks, I appreciate that information.. it's helped out alot. It seems like something I'm really wanting to do after reading the docs on LVM.

But, I have a simple question that I think I have the answer to but I want to run it past anyone else.

I have a single drive right now in my system that I have Gentoo on now. (wink2 for the wife since she likes the pretty colors, and gentoo for me) I plan on putting in another drive at a later point, but I don't want to wait until then to set the system up properly. Now, from my understanding, I can make my gentoo partitions type 0x8e and create the PV's out of those partitions. When I create the Logical Volumes, I want to setup striping to accomodate the drive that I will be getting at a later time.
e.g. lvcreate -n stripedlv -i 2 -I 64 mygroup -L 20M
If a do everything normally but with striping, is it going to stripe across to the other partitions on the same drive? If so, is it possible to "turn on" striping a a later point, or would I have to backup my system and restore it once I get the other drive and redo the LVM+striping scheme?

When I create the Logical Volumes, I want to setup striping to accomodate the drive that I will be getting at a later time.

Why? You don't have to stripe in order to add drives down the road -- you can just add the new drive to your volume group. Striping is only used for performance reasons and, unless you're using SCSI, the performance increase is nominal since IDE sucks so bad (and the performance increase can actually be zero if you're running two IDE drives on the same channel or striping across 2+ partitions on the same disk)

Plus, you run the risk of losing all your data if one volume in your striped set goes bad/gets corrupted, etc.

Not to slam striping -- it certainly has its uses, but I haven't seen good ones on regular desktop machines. (and it's almost always better to stripe in hardware anyway)

--kurt_________________The problem with political jokes is that they get elected

Why? You don't have to stripe in order to add drives down the road -- you can just add the new drive to your volume group. Striping is only used for performance reasons and, unless you're using SCSI, the performance increase is nominal since IDE sucks so bad (and the performance increase can actually be zero if you're running two IDE drives on the same channel or striping across 2+ partitions on the same disk)

Well, I do alot of harddisk intensive activity, and I figured striping would spread that load across two drives. I've wanted to do this for years, but I've never been able to for various reasons. I'm running IDE, and the drive is going to be on the second channel on a newer system that has full bandwidth on that channel.

Quote:

Plus, you run the risk of losing all your data if one volume in your striped set goes bad/gets corrupted, etc.

Yeah, I know the risks involved... I've thought about them since I learned about it with NT 4.0 coming out.

Quote:

Not to slam striping -- it certainly has its uses, but I haven't seen good ones on regular desktop machines. (and it's almost always better to stripe in hardware anyway)

I wish I had the money to purchase that hardware... economic feasibility is a limiting factor for me. My daughter comes before my Sun.. or Intel for that matter. (pun intended...)

Well, I do alot of harddisk intensive activity, and I figured striping would spread that load across two drives

OK, fair enough. Just as a counter-point, you can often manage IDE's limited resources almost as well as striping by placing your partitions in a judicious fashion. (placing /usr on hda and /home on hdb)

But, I'm an admitted skeptic when it comes to software striping, so salt-to-taste.

If you get it up and running, please do post your results here -- I'm sure it will be helpful to others looking to do the same thing.

--kurt_________________The problem with political jokes is that they get elected

OK, fair enough. Just as a counter-point, you can often manage IDE's limited resources almost as well as striping by placing your partitions in a judicious fashion. (placing /usr on hda and /home on hdb)

Yeah, I've thought about that too... I still need an answer to my question though before I can even think about LVM though

Quote:

But, I'm an admitted skeptic when it comes to software striping, so salt-to-taste.

Same here.. software anything is bad, but gotta start somewhere
I broke myself trying to get software raid to work, hope this is different.

Just from everything I've been reading about it, you have to wipe the drives. Just judging by the number of layers associated with LVM and it's complexitiy below the filesystem, i don't really think this is possible..reinventing the whole partition-scheme, essentially... creating a new base for the filesystem to sit on.

Just from everything I've been reading about it, you have to wipe the drives. Just judging by the number of layers associated with LVM and it's complexitiy below the filesystem, i don't really think this is possible..reinventing the whole partition-scheme, essentially... creating a new base for the filesystem to sit on.

You don't need to wipe your entire disk clean to use LVM, you just need to blow away one partition. I run LVM on my single IDE HD. fdisk shows:

hda3 - my LVM partition, I created a PV using it, and created vg0, then in it I have a LVs that get mounted as:

/home - 4 GB - XFS

/usr - 3 GB - XFS

/var - 2 GB - ReiserFS

/tmp - 1 GB - ReiserFS

hda4 - my 8GB WinXP Pro partition - NTFS

I would like to mention a few things to anyone trying to setup their disk similar to mine. I first installed Gentoo and the LVM partitions then when I tried to boot from the WinXP cd, it choked. The solution was to set the 0x7 bit on my soon to be WinXP partition so the setup knew where it was going. I'm not sure if anyone has experienced this before, just thought I'd mention it.

Also, Gentoo has the new bleeding edge Gentoo kerenl that doesn't contain XFS support. Not sure if you were considering XFS, but also note that XFS filesystems cannot shrink, they can only grow. Reiserfs on the other hand can shrink and grow. I guess if I don't have any problems with Reiserfs I will probably blow away my XFS partitions in exchange for Reiserfs and the newer kernel.

I was reading all the documentation on LVM and the proper way of setting it up according to them, and I came to the section about striping. It appears that you can't add another disk into a striped logical volume.

which means I guess that if /opt gets too full and I have a striped logical volume for it, then I'm screwed. Perhaps I'll sway away from striping for right now. Either that, or not stripe certain logical volumes.

XFS is starting to look like it's not for me, also. (running it right now, I love it) If I were to reduce, I'd have to blow away the filesystem. Not cool.

I was reading all the documentation on LVM and the proper way of setting it up according to them, and I came to the section about striping. It appears that you can't add another disk into a striped logical volume.

Good to know -- I guess when you think about how the striping works, it makes sense that you can't add another HD to the mix. I believe there are some high-end hardware RAID controllers that can expand a RAID 5 array, but my understanding is they do it by essentially rebuilding the array on the fly.

Regarding XFS, there's a whole religious war going on on the mailing lists right now about XFS vs. ReiserFS vs. ext3. I even saw a couple mentions of UFS. Might be worth a read if you still have questions. _________________The problem with political jokes is that they get elected

Good to know -- I guess when you think about how the striping works, it makes sense that you can't add another HD to the mix. I believe there are some high-end hardware RAID controllers that can expand a RAID 5 array, but my understanding is they do it by essentially rebuilding the array on the fly.

Yeah, I agree... but it'd be great to have a striped system and if things get too full just slapping in another drive and expanding. I wonder how news servers and the such do it? I know they run RAID5, but how do they merge the new harddisk space into the same partition? the only way I can see how is to put the disk in, migrate the data over and remount the bigger disk. (or put the new disk under the old one...)

Quote:

Regarding XFS, there's a whole religious war going on on the mailing lists right now about XFS vs. ReiserFS vs. ext3. I even saw a couple mentions of UFS. Might be worth a read if you still have questions.

I know heh. I might just go with something thats actually in the default kernel from Linus, and stay safe. (reiserfs, ext2, ext3... Minix?? lol) I guess reiserfs has aged a little since the last time I've used it... maybe I should give it a second chance. It does shrink and grow...

I did it! (fully that is...) I decided to wait until later to even try striping simply because I'd be striping across partitions of the same disk, but everything including root is on LVM.

There are a few changes/additions that should be done to the instructions to make them easier to work with for users who are using LVM... would I do a bug report on that, or what?

For documentation (and the poor souls who are searching for help on LVM installation with gentoo...) heres what I did in a nutshell:

* fdisked and created one partition for /boot, one for my LVM stuff, and another for swap. (LVM partition is type 8e)
* performed "vgscan"
* Created a physical volume for my LVM partition (/dev/hda7) with pvcreate
* created a volume group (vgcreate)
* created logical volumes for /, /usr, /usr/X11R6, /var, /home
* Created filesystems on hda6 and my logical volumes. (used reiserfs on /home and /var, the rest were ext3)
* created my mountpoints under /mnt/gentoo, then mounted everything
* I made /var under 500MB, so I changed my PORTAGE_TMPDIR to /usr/tmp (word of warning: I couldn't find resize_reiserfs on the gentoo boot disk at all... if you mess up, you'll need to remake the filesystem after extending any with reiserfs during the bootcd phase)
* compiled gentoo-sources with LVM support built in. (grsecurity gave me issues at medium security with LVM)
* Run "lvmcreate_initrd 2.4.19-gentoo-r1" to create your initrd in /boot. (take heed on the size of the loopback that it says.) If your ramdisk size is smaller than the loopback, you'll need to up it. (default=4096) Also, it *will* give you module errors, don't mind them right now.
* add initrd=/boot/initrd-2.4.19-gentoo-r1.gz into the /boot/grub/menu.lst below your kernel= line.
* After booting, you can make LVM a module and remake the initrd with lvmcreate_initrd.

Well, still fiddling with this, but it's up and working fine. I was *this* close to getting another drive tonight to try out striping, but I figured I'll wait until I have 159 bucks in my hand for one of the 120 gig drives.