Setting Up a Virtual Machine in VirtualBox from a .img Disk Image

watch 2m, 6s
views 2

10:05, 18.06.2026

Article Content
arrow

  • Converting IMG to VDI for VirtualBox
  • Using a VDI File in KVM with Virt-Manager
  • Using the image in Virt-Manager

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:

  1. Open a terminal or command prompt.
  2. Run the following command:
  3. 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

  1. Open Virt-Manager and start the "New Virtual Machine" wizard.
  2. Choose "Import existing disk image" as your installation method.
  3. Browse and select the .qcow2 (or .vdi, if supported).
  4. Set up the rest of your VM configuration — RAM, CPU, OS type, etc.
  5. 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.

Share

Was this article helpful to you?

VPS popular offers

-10%

CPU
CPU
8 Epyc Cores
RAM
RAM
32 GB
Space
Space
200 GB NVMe
Bandwidth
Bandwidth
Unlimited
Keitaro KVM 32768
OS
CentOS
Software
Software
Keitaro

77.54 /mo

/mo

Billed annually

-8.8%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
400 GB HDD
Bandwidth
Bandwidth
300 Gb
wKVM-HDD HK 16384 Windows

46.23 /mo

/mo

Billed annually

-20.6%

CPU
CPU
6 Xeon Cores
RAM
RAM
8GB
Space
Space
100GB SSD
Bandwidth
Bandwidth
500GB
KVM-SSD 8192 HK Linux

59 /mo

/mo

Billed annually

-10%

CPU
CPU
8 Xeon Cores
RAM
RAM
32 GB
Space
Space
200 GB SSD
Bandwidth
Bandwidth
Unlimited
KVM-SSD 32768 Linux

69.99 /mo

/mo

Billed annually

-24.4%

CPU
CPU
2 Xeon Cores
RAM
RAM
1 GB
Space
Space
20 GB SSD
Bandwidth
Bandwidth
300 GB
KVM-SSD 1024 HK Linux

13 /mo

/mo

Billed annually

-16.2%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
50 GB SSD
Bandwidth
Bandwidth
60 Mbps
DDoS Protected SSD-KVM 4096 Linux

67 /mo

/mo

Billed annually

-10%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
100 GB SSD
Bandwidth
Bandwidth
Unlimited
wKVM-SSD 4096 Windows

18.65 /mo

/mo

Billed annually

-10%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
400 GB HDD
Bandwidth
Bandwidth
Unlimited
KVM-HDD 16384 Linux

50 /mo

/mo

Billed annually

-10%

CPU
CPU
10 Epyc Cores
RAM
RAM
64 GB
Space
Space
400 GB NVMe
Bandwidth
Bandwidth
Unlimited
KVM-NVMe 65536 Linux

135.49 /mo

/mo

Billed annually

-10%

CPU
CPU
6 Epyc Cores
RAM
RAM
8 GB
Space
Space
100 GB NVMe
Bandwidth
Bandwidth
Unlimited
KVM-NVMe 8192 Linux

26.35 /mo

/mo

Billed annually

Other articles on this topic

cookie

Accept cookies & privacy policy?

We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the HostZealot website.