[CentOS-virt] Best practices for LVM and virtualization

Mathieu Baudier mbaudier at argeo.org
Tue Feb 9 19:00:22 UTC 2010


I'm currently setting up a virtualization infrastructure based on
CentOS 5.4 x86_64 and KVM.

I want to use LVM because of its flexibility, especially the ability
to add more disk space to a guest if needed.
We are considering using an hardware RAID1 with BBU as the lowest layer.

My question is: where is it recommended to put the LVM?

1. On the host only
In that case, the guests would see logical volumes as hard drives and
would be installed with "plain" partitions (ext3 / swap)
When more space is needed the logical volume (from host perspective) /
drive (from guest perspective) would simply become bigger.
This feels simple, but I wonder whether there may be side effects,
since real harddrive cannot grow, and maybe some parts of the system
expect them to stay of a given size.

2. On the guest only
On the host, there would only be "plain" raw partitions, which the
guest would see as hard drives.
The guest would be installed with an LVM and when more space is
needed, an additional partition (from host perspective) / drive (from
guest perspective) would be added to the guest volume group, which
would then become bigger, allowing logical volumes to grow.
I'm not too comfortable with that, since my understanding of the role
of the host is to manage resources for the guests: memory, CPUs so I'd
like to have some powerful abstraction there for disk space as well,
which is one purpose of LVM. The guest would then need to be restarted
when space is added.

3. On both host and guest
LVM would be installed on the host, which would then provide the
logical volumes as hard drives for the guest.
The guest would use them as additional drives to be added to its own
volume group when it needs to grow.
This feels the most flexible, but I wonder whether it is not wrong to
add LVM layers upon LVM layers, from a
performance/stability/simplicity perspective. The guest would probably
have to be restarted when more space is needed (I've not tested this
extensively yet)

I would be very interested to have your opinion / experience about
this before I go further in my testing!



More information about the CentOS-virt mailing list