Full Guide to qemu-img convert: Convert, Compress, and Manage Virtual Disk Images
A Step-by-Step Tutorial on Using qemu-img convert for Virtual Disks

Search for a command to run...
A Step-by-Step Tutorial on Using qemu-img convert for Virtual Disks

No comments yet. Be the first to comment.
A fast, cross-platform command-line tool for Google Drive — built with .NET 9, shipped as a single binary.

Email remains a fundamental tool for communication, and understanding how your email client retrieves messages from the server can help you make the best choice for your needs. The two most common pro

A Step-by-Step Guide to Moving Linux VMs from VMware ESXi 8 to SolusVM2 (KVM)

Learn How to Easily Configure a Static IP and Custom Routes on Ubuntu

Step-by-Step Guide to Linux Temporary Network Setup

qemu-img convert is a powerful utility for converting virtual disk images between different formats, resizing them, compressing, and even copying them efficiently. Whether you work with KVM, QEMU, VirtualBox, or VMware, understanding this tool can save you time and disk space. Here’s a comprehensive guide for beginners and advanced users alike.
qemu-img convert?qemu-img convert is part of the qemu-img suite. Its main function is to convert one disk image format to another, but it can also compress, sparsify, and resize images in the process.
Common formats supported:
qcow2 (QEMU/KVM native)
raw
vmdk (VMware)
vdi (VirtualBox)
vhd/vhdx (Microsoft Hyper-V)
parallels (Parallels Desktop)
qemu-img convert [options] -O <output_format> <input_image> <output_image>
Examples:
Convert a raw image to qcow2:
qemu-img convert -O qcow2 disk.raw disk.qcow2
Convert a vmdk (VMware) to qcow2:
qemu-img convert -O qcow2 disk.vmdk disk.qcow2
VMware VMDK to QCOW2 (KVM):
qemu-img convert -O qcow2 source.vmdk dest.qcow2
VirtualBox VDI to RAW:
qemu-img convert -O raw source.vdi dest.raw
RAW to VHDX (Hyper-V):
qemu-img convert -O vhdx source.raw dest.vhdx
Use the -c flag to compress supported formats (like qcow2):
qemu-img convert -c -O qcow2 source.qcow2 dest.qcow2
If your input image is thick provisioned (all blocks allocated), you can make the output sparse (only actual data blocks allocated):
qemu-img convert -O qcow2 thick.qcow2 sparse.qcow2
Use the -S (sparsify) option to ignore data blocks with only zeros, making the target image smaller:
qemu-img convert -O qcow2 -S 0 source.qcow2 dest.qcow2
You can encrypt the output qcow2 image:
qemu-img convert -O qcow2 --object secret,id=sec0,data=YOURPASSWORD \
-o encrypt.format=luks,encrypt.key-secret=sec0 source.raw dest.qcow2
Replace YOURPASSWORD with a strong password or use secret files as recommended by QEMU docs.
You can resize images after conversion with qemu-img resize:
qemu-img convert -O qcow2 source.raw dest.qcow2
qemu-img resize dest.qcow2 100G
For images with snapshots or backing files, use --backing-chain to include the entire chain:
qemu-img convert -O qcow2 --backing-chain snap.qcow2 full.qcow2
-O <fmt>: Output format (qcow2, raw, vmdk, vdi, vhdx, etc.)
-c: Compress the output image (for supported formats)
-p: Show progress bar
-S <size>: Sparsify zeros (ignore zeroed blocks above this size)
-f <fmt>: Input format (auto-detected if omitted)
--backing-chain: Convert the entire snapshot/backing chain
-o <options>: Format-specific options (e.g., cluster_size for qcow2, preallocation, encryption)
-n: Do not create the output file, just test conversion
Always backup your disk images before converting or overwriting!
For best compaction, zero-fill free space inside the guest OS before converting (e.g., with dd or SDelete).
After conversion, use qemu-img info <image> to inspect the result.
When moving VMs between hypervisors, check for driver and hardware compatibility after conversion.
Error: “format not supported”
Make sure you have the necessary QEMU modules/libraries for your source/target formats.
Image won’t boot after conversion
Check that your VM configuration matches the new format (bus type, drivers, etc.)
qemu-img convert is your Swiss Army knife for virtual disk image management—whether you’re migrating between platforms, reclaiming space, or compressing images for backups. Experiment in a safe environment and take regular backups to make the most of this essential tool!
I’m Kumar Bishojit Paul, the Founder and CEO of BIKIRAN. If you need further assistance, please leave a comment. I’m interested in helping you.
Bikiran is a software development and cloud infrastructure company founded in 2012, headquartered in Khulna, Bangladesh. With 15,000+ clients and over a decade of experience, Bikiran builds and operates a suite of products spanning domain services, cloud hosting, app deployment, workflow automation, and developer tools.
| SL | Topic | Product | Description |
|---|---|---|---|
| 1 | Website | Bikiran | Main platform — Domain, hosting & cloud services |
| 2 | Website | Edusoft | Education management software for institutions |
| 3 | Website | n8n Clouds | Managed n8n workflow automation hosting |
| 4 | Website | Timestamp Zone | Unix timestamp converter & timezone tool |
| 5 | Website | PDFpi | Online PDF processing & manipulation tool |
| 6 | Website | Blog | Technical articles, guides & tutorials |
| 7 | Website | Support | 24/7 customer support portal |
| 8 | Website | Probackup | Automated database backup for SQL, PostgreSQL & MongoDB |
| 9 | Service | Domain | Domain registration, transfer & DNS management |
| 10 | Service | Hosting | Web, app & email hosting on NVMe SSD |
| 11 | Service | Email & SMS | Bulk email & SMS notification service |
| 12 | npm | Chronopick | Date & time picker React component |
| 13 | npm | Rich Editor | WYSIWYG rich text editor for React |
| 14 | npm | Button | Reusable React button component library |
| 15 | npm | Electron Boilerplate | CLI to scaffold Electron.js project templates |
| 16 | NuGet | Bkash | bKash payment gateway integration for .NET |
| 17 | NuGet | Bikiran Engine | Core .NET engine library for Bikiran services |
| 18 | Open Source | PDFpi | PDF processing tool — open source |
| 19 | Open Source | Bikiran Engine | Core .NET engine — open source |
| 20 | Open Source | Drive CLI | CLI tool to manage Google Drive from terminal |
| 21 | Docker | Pgsql | Docker setup for PostgreSQL |
| 22 | Docker | n8n | Docker setup for n8n automation |
| 23 | Docker | Pgadmin | Docker setup for pgAdmin |
| 24 | Social Media | Bikiran on LinkedIn | |
| 25 | Social Media | Bikiran on Facebook | |
| 26 | Social Media | YouTube | Bikiran on YouTube |
| 27 | Social Media | FB n8nClouds | n8n Clouds on Facebook |