Kvm lvm dynamic addition of Virtual Machine disk best practices 1. when the VM is installed, use the LVM partition of the host 1.1 to create the lvm partition # lvcreate-L 10G-n lv_vm_img vg1.2 use this partition to create the VM # koan -- server = localhost -- port = "11180" -- virt -- system = "vm_img1" -- virt-path = "/dev/mapper/vg-lv_vm_img" -- virt-type = kvm -- qemu-disk-type = virtio -- qemu-net- type = virtio www.2cto.com 2. create an lvm partition for the VM to add new disk space 2.1 host # lvcreate-L 40G-n lv_vm_img1 vg2.2 add this partition to the VM # virsh attach-disk -- domain vm_img1 -- source/dev /mapper/vg-lv_vm_img1 -- target vdb -- persistent2.3 enter the VM to expand the VG space # virsh console vm_img1Connected to domain vm_img1Escape character is ^] CentOS release 6.3 (Final) kernel 2.6.32-279.2.1.el6.x86 _ 64 on an x86_64 www.2cto.com vm_img1 login: rootPassword: * *********** # pvcreate/dev/vdb # vgextend vg_vm_img1/dev/vdb # vgs 2.4 create lv # lvcreate-L 20 for specific applications of virtual machines g-n lv_www vg_vm_img1 # mkfs. ext4/dev/mapper/vg_vm_img1-lv_www # vi/etc/fstab/dev/mapper/vg_vm_img1-lv_www/var/www ext4 defaults 1 2 # mount/var/www # fixfiles restore/var/