I have a machine setup with Centos6 as a virtualisation host. It has a single 250G hard drive that is configured as a single lvm volume group(vg_fluke). Now I would like to use the host's lvm as a storage pool for KVM.

I found this question on SF and method one describes what I would like to achieve. But I can't find a way to go about it.

I tried the following, but since the documentation is sketchy, I am certain that I am doing something wrong.

virsh # pool-define-as guest_images_lvm logical - - - - /dev/vg_fluke
Pool guest_images_lvm defined

And followed it with,

virsh # pool-start guest_images_lvm
error: Failed to start pool guest_images_lvm
error: internal error Child process (/sbin/vgchange -ay -) status unexpected: exit status 5

More Information on the LVM setup:

[root@fluke ~]# pvs
  PV         VG       Fmt  Attr PSize   PFree  
  /dev/sdb2  vg_fluke lvm2 a--  232.39g 125.45g
[root@fluke ~]# lvs
  LV      VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_home vg_fluke -wi-ao   5.00g                                      
  lv_root vg_fluke -wi-ao 100.00g                                      
  lv_swap vg_fluke -wi-ao   1.94g                                      
[root@fluke ~]# vgs
  VG       #PV #LV #SN Attr   VSize   VFree  
  vg_fluke   1   3   0 wz--n- 232.39g 125.45g


Followed @sitaktif's advice and now get the following error:

virsh # pool-define-as lv_guest_vm logical --target /dev/vg-main
Pool lv_guest_vm defined

virsh # pool-start lv_guest_vm
error: Failed to start pool lv_guest_vm
error: internal error '/sbin/vgchange -ay lv_guest_vm' exited with non-zero status 5 and signal 0:   Volume group "lv_guest_vm" not found

Note: I am on trying this on a different machine where the VG is vg-main. Do I have to create a second VG for libvirt to use for virtual machines? How can I set it up use a LV in the existing VG?

3 Answers 3


The following command is incorrect:

virsh # pool-define-as guest_images_lvm logical - - - - /dev/vg_fluke

...because it executes:

/sbin/vgchange -ay -

...instead of:

/sbin/vgchange -ay /dev/vg_fluke

Just explicitely name the parameter instead of using dashes:

pool-define-as guest_images_lvm logical --target /dev/vg_fluke

That should solve your problem.

  • Thanks for reply. I just got around to trying it, but there is a new error now. I updated the question with the relevant details.
    – Shoan
    Apr 26, 2012 at 12:51

By default, libvirt uses the pool name as the name of the vg. You can see it's doing that with the /sbin/vgchange -ay lv_guest_vm command that it tried to execute. Just do:

pool-define-as lv_guest_vm logical --source-name vg-main --target /dev/vg-main

and it should work.


Some more things to try if you cannot get this to work:

If the --source-name (from Wil Tan's answer) does not help, consider --source-dev to make the connection to the layer beneath LVM explicitly:

virsh pool-define-as vg_fluke logical --target /dev/vg_fluke --source-dev /dev/md999

If you are having trouble, start with naming the storage pool identical to the volume group.

Also, after a pool creation look at it with e.g. ...

virsh pool-list  --all
virsh pool-info vg_fluke

... which may give you additional clues.

The question is also referring to sharing lvm volume group between host and guests. To avoid problems however be sure to use an lvm volume (not group) of the host as a hard disk(not lvm volume) on the guest. This volume may be part of a group or storage pool as long as these are only directly manipulated on the host. And on the guest, you may build a lvm-layer on top of this hard disk, but this is separated from the host's lvm entirely. And for extra clarity, please state whether the commands (you are citing) are done on the host or the guest. The commands I am citing here are all performed on the host.

About the question...

Do I have to create a second VG for libvirt to use for virtual machines?

As far as I stumbled into this by accident, I found no reason to separate volumes known to libvirt from volumes not known to libvirt into separate volume groups.

With "known to libvirt" I mean: libvirt shows them as volumes inside the storage pool. E.g. via...

virsh vol-list vg_fluke

But then again, if you cannot get things to work, start with a separate volume group to sort out another possible source of problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .