====== Overview ====== KVM is a virtualization hypervisor for linux ====== qcow2 vs raw disk ====== As of November, 2012 and on ubuntu 12.04 disk I/O was actually better with a qcow2 image that had preallocate=metadata option done to it. Raw disk I/O was slightly lower. As cache has been disabled in both instances it's unclear why this is the case when all information online points to a raw disk image would be better. ====== Converting qcow2 and raw images ====== ===== Convert qcow2 to raw ===== * Shutdown the vm if it's running * ''qemu-img info /path/to/file.qcow2'' * Note the size given for virtual size * ''sudo lvcreate -L 12345678b -n kvm_vm1 vg0'' where 12345678 is the size you got from above command. Remember the b at the end * ''sudo qemu-img convert /path/to/file.qcow2 -O host_device /dev/mapper/vg0-kvm_vm1'' * ''virsh edit vm1'' and change it from this
* to this
===== Convert raw to qcow2 ===== * Shutdown the vm if it's running * ''sudo lvcreate -L 12345678b -n kvm_vm1 vg0'' where 12345678 is the size you got from above command. Remember the b at the end * ''sudo qemu-img convert /dev/mapper/vg0-kvm_vm1 -O qcow2 -o preallocation=metadata /srv/kvm/vm1/disk0.qcow2'' * ''virsh edit vm1'' and change it from this
* To this:
====== References ====== * [[http://itscblog.tamu.edu/improve-disk-io-performance-in-kvm/|Improve disk I/O performance in KVM]] * [[https://www.nnbfn.net/2011/03/convert-kvm-qcow2-to-lvm-raw-partition/|Convert KVM qcow2 to LVM raw partition]] * [[https://help.ubuntu.com/community/KVM|Ubuntu wiki on KVM]]