Convert .img File to .qcow2 File

This article provides a guide demonstrating how to convert .img file to .qcow2 file.

What is .img File?

An IMG file, a.k.a. raw image, contains a complete and uncompressed image of a storage device's data content. The image includes the value of each memory location of the storage device, ordered sequentially such that the data can be written to a similar device to completely overwrite its content.

What is .qcow2 File?

qcow2 is an updated version of the qcow format. qcow2 supports AES encryption. The difference from the original version is that qcow2 supports multiple snapshots using a newer, more flexible model for storing them. The official documentation for the format is part of the QEMU Git tree.

How to Convert .img File to .qcow2 File

To convert .img file to .qcow2 file, follow the steps below:

  1. SSH the server as root.
  2. Install qemu-utils package:
    • Debian/Ubuntu:
      sudo apt-get install qemu-utils -y
    • RHEL/AlmaLinux/Rocky Linux:
      sudo dnf install qemu-utils -y
  3. Run the following command, replacing input.img with the .img file name and output.qcow2 with the desired .qcow2 file name:
    qemu-img convert -f raw -O qcow2 input.img output.qcow2

Conclusion

You now know how to convert .img file to .qcow2 file.

  • file conversion, file, img, qcow2, qemu
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...

Set Server Time Zones with Timedatectl

This article provides a guide to setting the server time and server time zone settings using...

htaccess RewriteRule Examples

Here are some useful mod_rewrite RewriteRule redirect examples that you can use in your .htaccess...

Using htaccess File to Block IPs

If your webserver is Apache, you may block access to your website from specific IP addresses...