[CentOS-virt] Best practices for LVM and virtualization

Wed Feb 10 15:35:59 UTC 2010
Mathieu Baudier <mbaudier at argeo.org>

Got it!

As per: http://www.linux-kvm.org/page/Hotadd_pci_devices
You need to load the acpiphp kernel module:

[root at localhost ~]# modprobe acpiphp

(I could not find pci_hotplug, but it worked without it)

If you then add a new disk from virsh:

virsh # attach-disk 9 /dev/mapper/vg_alma_fast-lv_test_virtlvm2 vdb
Disk attached successfully

It is automatically detected:

[root at localhost ~]# ll /dev/vdb
brw-r----- 1 root disk 253, 16 Feb 10 16:26 /dev/vdb

I could then extend the guest's LVM:

[root at localhost ~]# pvcreate /dev/vdb
  Physical volume "/dev/vdb" successfully created
[root at localhost ~]# vgextend VolGroup00 /dev/vdb
  Volume group "VolGroup00" successfully extended
[root at localhost ~]# lvextend -l +100%FREE  /dev/VolGroup00/LogVol00
  Extending logical volume LogVol00 to 6.84 GB
  Logical volume LogVol00 successfully resized

Thanks a lot for your help!!

For reference, here are two interesting posts from the CentOS mailing
list which are related to this topic:
- Similar procedure (with Xen): LVM on both host and guest and adding
additional space as disks:
http://lists.centos.org/pipermail/centos-virt/2009-September/001161.html
- Extending LVMs (a bit dated):
http://lists.centos.org/pipermail/centos/2005-November/013471.html