Best practices for dynamically adding virtual machine disks to KVM LVM

Source: Internet
Author: User
Tags to domain


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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.