Jeff Boyce
2011-Dec-08 00:43 UTC
[CentOS-virt] Selecting raw logical volumes during guest VM creation
Greetings - I have stepped through the first guest OS installation (a testing VM) on my new server and have a technical question that I hope someone might be able to help me with. I have exhausted my google search ability and have not been able to find the details I am looking for. In general the question I am trying to answer is how to select and use multiple raw logical volumes when creating a new VM, rather than just a single raw logical volume (if it is possible). Here are the details... I have setup my hardware with a single volume group (vg_mei) encompassing my entire raid array. With this I set up my base OS (CentOS 6) for the purpose of managing the hardware and the few VMs that will be created (using KVM). Three LVs were created for the base OS (lv_hostroot, lv_hostswap, and lv_hostvar) to contain the appropriate parts of the base OS file system. As expected, /boot was located outside the volume group. In preparation for installing my testing VM, I created two more LVs (lv_testroot and lv_testvar) to contain the appropriate parts of the guest file system. Following the RHEL6 Virtualization Guide (Section 25.1.4 for using LVM-based Storage Pools) I successfully added all the logical volumes that had been created into the host storage pool. So when I start the Virt-Manager GUI and work through the five steps for creating a new VM (shown in Section 6.3 of the RHEL6 Virtualization Guide), Step #4 provides the option for creating or using existing storage for the VM. When I select the option to use "managed or other existing storage" then choose the browse button, I am given a dialog box that displays all LVs that I have previously created. At this point though I am only allowed to select a single LV to install the guest OS. So I chose the lv_testroot logical volume and the installation was able to be completed (there was a little manual intervention required during the OS installation partitioning layout in order to prevent nesting LVMs). But I am wondering if there is a way during Step #4 of the VM creation to pass multiple LVs to the system so that during the OS installation process you have all the LVs that you want for the partitioning layout. I assume that there is a way to add an LV to an existing VM after the guest OS is installed, then move portions of the file system over to the added LV. Following my example above, adding lv_testvar to the testing VM then move my /var directory over and add an entry in fstab to mount it at boot time. I am doing some google searching right now to try and verify the details on how to do this. I curious about the best way to do the VM setup since I will be creating a new VM for my Samba file server, which will also include the users home directories. So for the Samba VM I will create in advance LVs for /, /var, /home, and /sambashare. Also is it possible to likewise add an LV for /swap after the fact (or is it really needed anymore for something like a small file server)? I want to use raw LVs from my host system in order to be able to use the full capabilities of LVM for each of my guest VMs. I realize that this may create a number of LVs to manage, but I don't expect to have more than 4 VMs on this box and I have worked out a good naming scheme for the LVs in order to keep track of everything. Any technical help, or pointers to blogs or technical documents that I may have missed, is greatly appreciated. Thanks. Jeff Boyce Meridian Environmental www.meridianenv.com
Travis
2011-Dec-08 10:45 UTC
[CentOS-virt] Selecting raw logical volumes during guest VM creation
You can add additional lvs to your guest system as separate virtual hard drives, this is the way I know of to achieve what you are trying to do. Create additional virtual drives using the lvs you want as the storage, then attach them to the vm. Hope this helps. On Dec 7, 2011 7:43 PM, "Jeff Boyce" <jboyce at meridianenv.com> wrote:> Greetings - > > I have stepped through the first guest OS installation (a testing VM) on my > new server and have a technical question that I hope someone might be able > to help me with. I have exhausted my google search ability and have not > been able to find the details I am looking for. In general the question I > am trying to answer is how to select and use multiple raw logical volumes > when creating a new VM, rather than just a single raw logical volume (if it > is possible). Here are the details... > > I have setup my hardware with a single volume group (vg_mei) encompassing > my > entire raid array. With this I set up my base OS (CentOS 6) for the > purpose > of managing the hardware and the few VMs that will be created (using KVM). > Three LVs were created for the base OS (lv_hostroot, lv_hostswap, and > lv_hostvar) to contain the appropriate parts of the base OS file system. > As > expected, /boot was located outside the volume group. In preparation for > installing my testing VM, I created two more LVs (lv_testroot and > lv_testvar) to contain the appropriate parts of the guest file system. > Following the RHEL6 Virtualization Guide (Section 25.1.4 for using > LVM-based > Storage Pools) I successfully added all the logical volumes that had been > created into the host storage pool. So when I start the Virt-Manager GUI > and work through the five steps for creating a new VM (shown in Section 6.3 > of the RHEL6 Virtualization Guide), Step #4 provides the option for > creating > or using existing storage for the VM. When I select the option to use > "managed or other existing storage" then choose the browse button, I am > given a dialog box that displays all LVs that I have previously created. > At > this point though I am only allowed to select a single LV to install the > guest OS. So I chose the lv_testroot logical volume and the installation > was able to be completed (there was a little manual intervention required > during the OS installation partitioning layout in order to prevent nesting > LVMs). But I am wondering if there is a way during Step #4 of the VM > creation to pass multiple LVs to the system so that during the OS > installation process you have all the LVs that you want for the > partitioning > layout. > > I assume that there is a way to add an LV to an existing VM after the guest > OS is installed, then move portions of the file system over to the added > LV. > Following my example above, adding lv_testvar to the testing VM then move > my > /var directory over and add an entry in fstab to mount it at boot time. I > am doing some google searching right now to try and verify the details on > how to do this. > > I curious about the best way to do the VM setup since I will be creating a > new VM for my Samba file server, which will also include the users home > directories. So for the Samba VM I will create in advance LVs for /, /var, > /home, and /sambashare. Also is it possible to likewise add an LV for > /swap > after the fact (or is it really needed anymore for something like a small > file server)? I want to use raw LVs from my host system in order to be > able > to use the full capabilities of LVM for each of my guest VMs. I realize > that this may create a number of LVs to manage, but I don't expect to have > more than 4 VMs on this box and I have worked out a good naming scheme for > the LVs in order to keep track of everything. > > Any technical help, or pointers to blogs or technical documents that I may > have missed, is greatly appreciated. Thanks. > > > Jeff Boyce > Meridian Environmental > www.meridianenv.com > > _______________________________________________ > CentOS-virt mailing list > CentOS-virt at centos.org > http://lists.centos.org/mailman/listinfo/centos-virt >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos-virt/attachments/20111208/29424647/attachment-0006.html>