Home VM Tips Raw vs Qcow2 Image | Which Is Better for KVM Environment?

Raw vs Qcow2 Image | Which Is Better for KVM Environment?

2023-01-01 | Nick Zhao

Table of contents
  • Raw Disk Image
  • Qcow2 Disk Image
  • Convert Raw/Qcow2 disk image format
  • Backup and migrate VM with Vinchin Backup & Recovery
  • Sum Up

Are you looking for a robust virtual machine backup solution? Try Vinchin Backup & Recovery for multiple hypervisors.

Raw Disk Image

In KVM or OpenStack environment, virtual hard disks are needed to store VM data. Unlike physical drives, they are just files in datastore and the popular format of virtual hard disks are RAW and Qcow2.

Raw means being in its natural state and unformatted disk. In Linux, Raw image is a kind of pure binary image. In the file system which supports sparse files, Raw image just takes the actual storage of disk data.

Because of its “raw” feature, the performance of Raw image is nearly close to the physical drive, which also means it has excellent performance. Also because of this feature, it can be directly attached to VM. Another advantage of Raw image is it is simple to convert Raw image to other kinds of image, like converting raw image to VMware vmdk image. Sometimes it can be used as the intervening format when one kind of image is needed to be converted to another.

When displaying storage usage, it will show the actual occupied storage like physical drive. What’s more, Raw image is easy to extend and has good interaction with systems but it doesn’t support snapshot so you can convert Raw to Qcow2 before taking snapshot. However, it is allowed to use version managing software to manage Raw images. By rolling back to the previous version, it works like snapshot.

Qcow2 Disk Image

Qcow2 is short for QEMU Copy on Write 2, a kind of virtual image format supported by QEMU emulator. Like Raw image, Qcow2 is also a popular image format in virtual environment and at present, it has nearly the same excellent performance as Raw image. Compared with the common Raw image, it has other features:

1. Qcow2 image occupies less storage because the file system doesn’t support holes. Generally speaking, Qcow2 image is smaller than Raw image. The file only grows when the disk space is really occupied by virtual machine. This will reduce the drive during migration so it is better for cloud computing system.

2. Qcow2 image supports COW and copy-on-write and it only reflects the change of the underlying disk

3. Qcow2 image supports snapshot and one image can include multiple snapshots.

4. Qcow2 can use the zlib compression and it allows every cluster to use zlib compression independently.

5. Qcow2 can use AES encryption and this means supporting 128-bit key for encryption.

Convert Raw/Qcow2 disk image format

Raw image and Qcow2 image can be converted into the other image format. The needed conversion tool is QEMU-img.

After the deployment of QEMU-img, it is only one command that is needed to convert the image format.

To convert Qcow2 to Raw:

qemu-img convert -p -f qcow2 -O raw /folder/image_name.qcow2 /folder/image_name.raw

-p: presenting the conversion progress

-f: format of the source image

-O: format of the target image

To convert Raw to Qcow2:

qemu-img convert -p -f raw -O qcow2 /folder/image_name.raw /folder/image_name.qcow2

Backup and migrate VM with Vinchin Backup & Recovery

You might once backup VM by cloning or exporting VM and this requires using command lines and manual archiving. Backing up VM in this way will influence VM security and recovery efficiency. You can optimize your disaster recovery solution this time.

Vinchin Backup & Recovery is a professional backup and disaster recovery solution which has protected thousands of companies' virtual environments like Red Hat Virtualization, oVirt, Oracle Linux KVM, OpenStack,etc. (Native KVM is not supported for now) Compared with traditional backup solution, it provides a user-friendly web console to let you easily backup VM and manage VM backup.

Vinchin Backup & Recovery

You can add the hosts into Vinchin backup system and backup VMs agentlessly. With VM backup file, you can easily select another virtualization platform to restore it for cross-platform VM migration. Virtual hard disk will be automatically converted for the destination host.

Vinchin Backup & Recovery provides many backup and recovery strategies for you like schedule backup, incremental backup, data deduplication & compression, instant recovery, file level recovery, etc. You can experience this convenient system immediately with a 60-day full-featured free trial. Just click the button the get the installation package.

Sum Up

Both Raw and Qcow2 are the popular image formats in KVM environment. According to the comparions in this passage, it looks like that Qcow2 image seems to have more advantages than Raw image.

To protect and manage virtual environment, you can trust Vinchin Backup & Recovery. Don’t miss the free trial.

Share on:

Categories: VM Tips