Setting Up a Virtual Machine in VirtualBox from a .img Disk Image
10:05, 18.06.2026
Sometimes, you have a .img disk image and want to use it to set up a virtual machine in VirtualBox or KVM. However, VirtualBox doesn't directly support .img files. In this guide, we'll show you how to convert the image into a compatible format and use it with VirtualBox and Virt-Manager.
This guide has you covered whether you're testing a custom OS, restoring a backup, or experimenting with virtual infrastructure.
Converting IMG to VDI for VirtualBox
VirtualBox supports several disk image formats—VDI, VMDK, and VHD—but not .img. To make the image compatible, we first need to convert it to VirtualBox Disk Image (.vdi) format using the VBoxManage CLI tool.
Your steps:
- Open a terminal or command prompt.
- Run the following command:
- VBoxManage convertfromraw disk_image.img disk_image.vdi --format VDI
- disk_image.img – your original disk image
- disk_image.vdi – the new VDI file you're creatin
Once done, you'll have a .vdi file ready for use in VirtualBox.
What next?
- Open VirtualBox and create a new virtual machine.
- When asked to select a hard disk, choose Use an existing virtual hard disk file and select your new .vdi.
- Finish setup and start the VM — done!
Using a VDI File in KVM with Virt-Manager
KVM (Kernel-based Virtual Machine) is another popular virtualization solution, especially Linux-based. While it typically uses the .qcow2 format, it also supports raw and other virtual disk types, including .vdi.
However, not all versions of Virt-Manager play well with .vdi files. If you encounter compatibility issues, you can convert the VDI to the native .qcow2 format using the qemu-img tool.
To convert .vdi to .qcow2, run:
qemu-img convert -O qcow2 disk_image.vdi disk_image.qcow2
This will create a new .qcow2 disk that you can use safely with Virt-Manager or KVM.
Using the image in Virt-Manager
- Open Virt-Manager and start the "New Virtual Machine" wizard.
- Choose "Import existing disk image" as your installation method.
- Browse and select the .qcow2 (or .vdi, if supported).
- Set up the rest of your VM configuration — RAM, CPU, OS type, etc.
- Finalize and boot your virtual machine.
Using .qcow2 is often better for KVM as it supports snapshots and uses less space.
Developers, sysadmins, and tech enthusiasts commonly convert and use disk images across different virtualization platforms. Knowing how to work with formats like .img, .vdi, and .qcow2 can save you hours of troubleshooting.
By following the simple steps above, you can quickly bring .img files into VirtualBox or KVM environments, keeping your workflow smooth and flexible — no matter the source of your disk image.