I have just built a shiny new KVM/libvirt-based virtual machine host, containing 4 SATA II hard drives, and running CentOS 5.5 x86_64.
I have decided to create virtual machine disks as logical volumes in an LVM volume group managed as a libvirt storage pool, instead of the usual practice of creating the disks as qcow images.
What I can't decide on is whether I should create the virtual machine logical volumes in the VM host's volume group, or in a dedicated volume group.
Which method should I choose, and why?
Method 1: Use the VM host's volume group
Implementation:
- small RAID1
md0containing the/bootfilesystem - large RAID10
md1occupying the remaining space, which contains an LVM volume groupvghost.vghostcontains the VM host's root filesystem and swap partition - create virtual machine disks as logical volumes in
vghostas required
Pros:
- if the VM host's root filesystem runs out of space, I can allocate more space from
vghostwith relative ease - The system is already up and running (but it is no big deal to start over)
Cons:
Depsite the fact that this method seems to work, I can't shake the feeling that this is somehow a bad idea. I feel that:
- this may somehow be a security risk
- at some point in the future I may find some limitation with the setup, and wish that I used a dedicated group
- the system (CentOS, libvirt, etc.) may not really be designed to be used like this, and therefore at some point I might accidentialy corrupt/lose the VM host's files and/or filesystem
Method 2: Use a dedicated volume group
Implementation:
- same
md0andmd1as in Method 1, except makemd1just large enough to contain for the VM host (eg. 5 to 10GB) - large RAID10
md2occuping the remaining space.md2contains an LVM volume groupvgvms, whose logical volumes are to be used exclusively by virtual machines
Pros:
- I can tinker with
vgvmswithout fear of breaking the host OS - this seems like a more elegant and safe solution
Cons:
- if the VM host's filesystem runs out of space, I would have to move parts of its filesystem (eg. /usr or /var) onto
vgvms, which doesn't seem very nice. - I have to reinstall the host OS (which as previously stated I don't really mind doing)
UPDATE #1:
One reason why I am worried about running out of VM host disk space in Method 2 is because I don't know if the VM host is powerful enough to run all services in virtual machines, ie. I may have to migrate some/all services from virtual machines to the host OS.
VM host hardware specification:
- Phenom II 955 X4 Black Edition processor (3.2GHz, 4-core CPU)
- 2x4GB Kingston PC3-10600 DDR3 RAM
- Gigabyte GA-880GM-USB3 motherboard
- 4x WD Caviar RE3 500GB SATA II HDDs (7200rpm)
- Antec BP500U Basiq 500W ATX power supply
- CoolerMaster CM 690 case
UPDATE #2:
One reason why I feel that the system may not be designed to use the host VG as a libvirt storage pool in Method 1 is some behaviour I noticed in virt-manager:
- upon add, it complained that it couldn't activate the VG (obviously, becuase the host OS has already activated it)
- upon remove, it refused to do so because it couldn't deactivate the VG (obviously, because the host OS is still using the root and swap LVs)