LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   /boot LVM (http://www.linuxquestions.org/questions/linux-hardware-18/boot-lvm-651157/)

sycamorex 06-23-2008 07:01 PM

/boot LVM
 
I've created LVM on my laptop

sda1 /boot (for lvm system)
sda2 lvm
sda3 lvm
sda4 extended
sda5 swap
sda6 centos
sda7 fedora

1.Gradually I will add the physical partitions to LVM. Is it necessary to keep /boot on a physical partition? (That's what I read somewhere)

2. Also, I've been reading about RAID. Is it possible to include a NAS to a RAID array? At the moment my NAS works as an ftp server. If it is possible, would it make any sense in terms of file access/write speed (when compared to local drives)?

3. I just want to confirm: there's no way I could convert sda6 and sda7 to LVM without losing the data on them, is there?
Can I copy those partitions to LVM space?

thanks

mostlyharmless 06-24-2008 12:19 PM

(1) Far as I know, boot has to be on a partition lilo or grub can read, which doesn't include LVM, yet :)

(2) Interesting idea, I'm sure you could get mdadm to include (almost)anything on a RAID set, but I think you'd better allow for delay times on reads and writes. I'm thinking this is not a great idea though, if it's a backup plan. As I'm sure you know, RAID is not backup. But it might be fun.

(3) I don't see why you couldn't mount the LVM partitions as well as the other partitions separately and copy over whatever you want, including the whole file system, then add them to LVM. Of course you might be space constrained and have to use your backup. But maybe I'm not understanding the question.

sycamorex 06-24-2008 12:36 PM

Quote:

(3) I don't see why you couldn't mount the LVM partitions as well as the other partitions separately and copy over whatever you want, including the whole file system, then add them to LVM. Of course you might be space constrained and have to use your backup. But maybe I'm not understanding the question.
So, I could copy my fedora on sda7 to a newly created logical volume. The only thing I'd have to do is to update grub entries.

thanks

sycamorex 06-25-2008 03:41 AM

hmmm,

I created new LVs in my VG and copied partitions 6 and 7 (fedora, centos) onto them. Now I've got a problem because I don't know how to update grub.

sda1 /boot (for lvm system)
sda2 pv1 \
sda3 pv2 | vg
sda4 pv3 /

My vg consists of:

Quote:

vol1 / centos1 (with /boot partition outside lvm)
vol2 /usr centos1
vol3 /var centos1
vol5 /tmp centos1
vol4 /home centos1
vol5 swap
vol6 / fedora (the whole system on one partition - copied from sda6)
vol7 / centos2 (the whole system on one partition - copied from sda7)
free space ( used to be sda6 and 7)
Now I'm trying to update the grub on centos1 with no luck. Is there any way to boot fedora and centos2 or does EACH system have to have /boot partition outside LVM?

thanks

mostlyharmless 06-25-2008 11:28 AM

I apologize; I did not realize you wanted to multiboot off of one LVM system. Interesting, but I don't see why you can't make it work.

I wouldn't think you'd have to reinstall grub, just change the menu.ls

I think that the different distros could share a /boot partition, if you are very careful that their boot files such as the kernel and initrd are not over written by each other. So they'll each need a different name, like vmlinuz-centos, vmlinuz-fedora, initrd-fedora etc. then I'd setup menu.lst with a different entry for each with a different specification of root=/dev/whatever the approprate volume name is.

You might need to remake the initrds for each of the distros to make sure that LVM is started appropriately. I'm out of my depth on that one, as each distro seems to load its file system differently and allow modification of its initrd differently.

sycamorex 06-25-2008 04:03 PM

No worries - it's not a critical server of Google so a bit of breaking the system won't do much harm:)

This is my menu.lst:
Code:

title CentOS (2.6.18-92.1.1.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.1.1.el5 ro root=/dev/xtdgroup/lv1root rhgb quiet noapic
        initrd /initrd-2.6.18-92.1.1.el5.img
title  Fedora 9
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.25.6-55.fc9.i686 ro root=/dev/xtdgroup/lv8_fedora rhgb quiet
        initrd /boot/initrd-2.6.25.6-55.fc9.i686.img

title CentOS2 (2.6.18-53.1.21.el5xen)
        root (hd0,1)
        kernel /boot/xen.gz-2.6.18-53.1.21.el5
        module /boot/vmlinuz-2.6.18-53.1.21.el5xen ro root=/dev/xtd8865/lv7_centos2 rhgb quiet noapic
        module /boot/initrd-2.6.18-53.1.21.el5xen.img


The first instance of Centos works (that's the one with /boot outside of lvm)

In F9 and Centos2 I agree that:
Code:

root (hd0,1)
will return an error.
As you said, I'd have to share the /boot partition, however, what exactly would I have to do? Copy the files from fedora /boot to /boot on the first partition? (Obviously making sure that the names of the files are not overlapping). I don't really understand how it would work.

any help
thanks

mostlyharmless 06-26-2008 11:27 AM

Here's what I was thinking:

You copy over the files over to the /boot partition without the names overlapping. The menu.lst changes so that all of the entries have root(hd0,0); as I'm sure you know grub's "root" is just the place where it finds the kernel, and has nothing to do with the root file system.

The hard part is modifying the initrd of the non-LVM aware distros Fedora 9 and CentOS2; I would imagine that the initrd in your original CentOS sets up the LVM, finds the volumes and mounts them appropriately (/ on vol1 of the LVM, /boot on /dev/sda1 /usr on vol2 etc.). You will have to modify the other two initrds to do the same; ie. mount / on vol6 and vol7, respectively with /boot on /dev/sda1. I (kindof)know how to do that for Slackware, but I'm not familiar with the differences for the other two distros. If nothing else, I remember reading somewhere that there is a way to mount the cpio archive initrd.gz as a file system using the loop device, modifying it, and saving it, which might be easier than trying to rebuild it without the native OSes up and running.

sycamorex 06-30-2008 07:19 AM

thanks, however I messed it up big time:) I couldn't boot any of the systems. Although it was recoverable, I decided to sort out my laptop and perform fresh installations. As I upload every new file (docs, music, etc) to my NAS on a daily basis, I did not have any problem with data loss.
regards
sycamorex

billymayday 06-30-2008 07:33 AM

Can I ask why you want to do this? You are probably going to have all sorts of fun when you do an update, and what's the benefit - a few fewer partitions?

The real benefit of LVM is that you can add new physical volumes in to a logical partition - ie increase a filesystem without additional mount points. You seem to be doing the opposite.

How many physical volumes are behind what you are doing?

sycamorex 06-30-2008 09:13 AM

I've already started the installation - it's my laptop - so I'm not likely to add any additional drives. However, as I appreciate the benefits of lvm, what I'm planning to do is to backup my main box and change the partition system to lvm (it makes much more sense on the main computer where I have a few drives)

thanks

sycamorex 06-30-2008 09:22 AM

Actually, I've got a question regarding installing new systems on lvm.
Provided that I have one /boot partition, I can then create LVM and install some distros (I'll mount /boot on the /boot without formatting the filesystem on /boot so that the files from different distros could coexist - the kernel files will probably not clash as centos 5.1, fedora 9, slackware 12.1 use different kernels 2.6.18, 2.6.25, 2.6.21 respectively. Is it going to work?

mostlyharmless 06-30-2008 10:29 AM

Well, it's like billymayday implied, the purpose of LVM, usually, is to combine physical volumes into a single filesystem without additional mount points. When you're installing different distros, you really want to keep their file systems separate. So while I don't think it'd be impossible to do what you plan, it might not be the best thing to try. Really, LVM isn't the issue here; the question is - can you install several distros on one file system and hide each of them from each other.

sycamorex 06-30-2008 10:34 AM

Quote:

So while I don't think it'd be impossible to do what you plan, it might not be the best thing to try. Really, LVM isn't the issue here
So provided that I can start from scratch. What would be better for a computer with say 4 distros - physical partitions or lvm?

mostlyharmless 06-30-2008 11:23 AM

My vote: 4 distros = 4 partitions or more. If you want LVM for something else (say, LUKS encryption), each distro can do LVM on its own partition. Basically I'd treat each distro as its own OS, just as if you were installing Microsoft Windows and BSD and Solaris....

billymayday 06-30-2008 04:14 PM

It also means if you have a filesystem problem, you don't lose all your distros if /boot get corrpted, etc.

I can't see a lot of advantages in LVM for what you are doing, and it's just harder to administer and a (minor) extra potential point of failure


All times are GMT -5. The time now is 04:55 AM.