问题原文
原帖链接 · turbonerd · CC BY-SA 4.0
On a CentOS 7 host, I'm creating a VM from an Amazon Linux 2 qcow2 image:
- Download Amazon Linux 2 cloud-init image (.qcow2 format)
- Copy this file, run
qemu-img resizeto expand it to 40G - Define it in my VM using
<disk type='file'>and<source file='my_resized_file.qcow2'>
This works - but I'm running ~30 VMs on this host, all running quite heavy Docker workloads - and the disk IO isn't good enough.
I want to try using iothreads, cache=none and io=native as a number of posts online indicate improved performance for SSDs and high-CPU count hosts with these settings. I have plenty of CPU to spare.
I've tried simply adding iothreads=1 to the domain and iothread=1 to the disk, but this fails with the error IOThreads not supported for this QEMU. I presume this is because I'm using disk type=file rather than disk type=block.
I would like to:
- Use the OS image, and its cloud-init functions
- Have 40G available to the VM
- Use raw file type,
iothreads,cache=noneandio=nativefor maximum performance
My question is therefore...
How do I get my qcow2 OS image to become a 40G raw block device that I can use with these parameters?
已采纳解答
原帖链接 · mforsetti · CC BY-SA 4.0
To convert from QCOW2 to RAW image file, use qemu-img convert, for example:
$ qemu-img convert -O raw /path/to/image.qcow2 /path/to/image.bin
IOThreads is supported on QEMU since QEMU 2.0. QEMU 2.0.0 is available on EPEL, so try to run:
# yum -y install epel-release
# yum makecache && yum -y install qemu
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
