| PeterSteele |
01-31-2013 07:37 AM |
KVM I/O performance: Raw partitions versus image files
We have a VM framework based on KVM where we slice our drives up into partitions of specific sizes and create our VMs against these partitions. For example, we might have a command such as
Code:
virt-install --connect=qemu:///system \
--network bridge=br0 \
--initrd-inject=/ks/ks.cfg \
--extra-args="ks=file:/ks.cfg text console=tty0 utf8 console=ttyS0,115200" \
--name=vm-test \
--disk path=/dev/sda3,bus=virtio \
--disk path=/dev/sda4,bus=virtio \
--accelerate \
--hvm \
--location=/iso/custom.iso \
--nographics \
--noreboot
In this case, our VM would have two virtual drives, /dev/vda (hosting the OS) and /dev/vdb (hosting the VM's core data). These are mapped against physical partitions 3 and 4 of the host's /dev/sda drive. These have been previously created and sized to meet our needs. Additional VMs may share the same physical drive using other partitions.
We were wondering if VMs mapped to physical partitions have any performance advantages over VMs that use pre-allocated image files. For example, instead of paritions sda3 and sda4 above, let's say we did this:
Code:
virt-install --connect=qemu:///system \
...
--disk path=/vmpool/vm-test-1.img,bus=virtio \
--disk path=/vmpool/vm-test-2.img,bus=virtio \
...
--noreboot
where vm-test-1.img and vm-test-2.img would have been previously created image files sized appropriately. I sometimes create VMs in exactly this manner, but I was always under the assumption that using a raw partition would yield better virtual disk performance than using image files. Our VMs can potentially be very I/O intensive, especially with the VM's data drive (/dev/vdb), so we're interested in what is the best approach to take.
The image files I am referring to here would be created using something like dd. I have never experimented with qcow2 image files. Would these be an option?
I am running KVM/libvirt under CentOS 6.3.
|