[libvirt-users] Using the host's LVM to manage virtual disks

Don Morrison dam at us.ibm.com
Mon Apr 26 13:21:32 UTC 2010


I've been able to do this both ways with libvirt/kvm. You have to define
your logical volume as a block device. I the example below (I use virsh to
create the VM), I created logical volume "my_lv" in volume group "host" and
was able to both install an OS into it and copy (via dd) a raw image into
it.  Resizing the logical volume is easy, but you still have to resize the
guest file systems to allow the guest to make use of the additional space
(or give up the space if reducing the size)

   <disk type='block' device='disk'>
      <source dev='/dev/host/my_lv'/>
      <target dev='sda' bus='scsi'/>
    </disk>


Don Morrison



                                                                           
             scar                                                          
             <scar at drigon.com>                                             
             Sent by:                                                   To 
             libvirt-users-bou         libvirt-users at redhat.com            
             nces at redhat.com                                            cc 
                                                                           
                                                                   Subject 
             04/23/2010 06:03          [libvirt-users] Using the host's    
             PM                        LVM to manage virtual disks         
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

i am envisioning a scenario that a fellow sysadmin is employing using
xen, where the host is configured with LVM.  basically, one volume group
spans the physical disk.  then, various logical volumes are created for
the host and (Linux) guest OSes.  this makes it easy to resize logical
volumes should it be needed.

is a setup like this possible with libvirt?  the best i can think up, so
far, is to create a new logical disk, vm1, and pass that as an argument
to the -f option of virt-install.  then, during the installation i can
setup LVM within the guest.  not sure if this would even work if i need
to expand the volume size.  first i would expand the size of vm1.  then,
within the vm1 OS i would expand the size of the root partition.

i would like to not have to use this second layer of LVM.  for example,
on the host OS, i would create two logical volumes: vm1-root and
vm1-swap, and these are what vm1 would use for root and swap.  then, if
needed, i can just increase the size of vm1-root, etc.

thanks

-----BEGIN PGP SIGNATURE-----

iEYEAREIAAYFAkvSJ08ACgkQXhfCJNu98qDAoQCfbdN84rlxmFJCwHnsaHXdv0l4
juUAmwfE2Te+l07VfkuJYUI2/us83F5e
=AmQ+
-----END PGP SIGNATURE-----

_______________________________________________
libvirt-users mailing list
libvirt-users at redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users





More information about the libvirt-users mailing list