Details and differences between Linux KVM QCOW2 and ROW

  • 2020-05-13 04:17:59
  • OfStack

QCOW2 is different from ROW

In the kvm virtual machine, you need to choose the format of the disk image. There are usually two options, one is raw image format, and the other is qcow2 format.

raw format is the original image, it will directly as a piece of equipment for the virtual machine to use, as for the inside of the file empty, is managed by the host file system, file system can well support hole under Linux features, so, if you have created a 100 G raw format file, ls look, you can see this file is 100 G, but with du, this file will be small.

qcow2 is the disk mirroring format supported by kvm. After we create a disk of qcow2 with 100G, it is very small whether viewed with ls or du. This means that qcow2 itself will record some internal block allocation information.

Regardless of the format, the disk utilization is the same, because the actual number of blocks occupied is the same. However, raw's virtual machine IO is more efficient than qcow2's virtual machine IO, and it will be 25% higher than qcow2 in the actual test. The performance difference is not small, so students who are in pursuit of performance suggest choosing raw.
The disadvantage of raw only 1 is that ls looks very big, which will consume a lot of network IO at scp, while a file as large as tar will also consume a lot of time and CPU. One solution is to convert raw to qcow2, which will compress the space a lot. And it's fast. The conversion command is as follows:

#qemu-img convert -O qcow2 disk.raw disk.qcow2

#qemu-img convert -O raw disk.qcow2 disk.raw

This conversion takes much less time than tar.gz.

qemu-img will read the metadata of the file directly, while tar will only read the metadata of the operating system.

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: