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

-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.33 /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

-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
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
30 GB SSD
Bandwidth
Bandwidth
Unlimited
KVM-SSD 2048 Linux

8.3 /mo

/mo

Billed annually

-15%

CPU
CPU
6 Xeon Cores
RAM
RAM
8 GB
Space
Space
100 GB SSD
Bandwidth
Bandwidth
80 Mbps
DDoS Protected SSD-wKVM 8192 Windows

101 /mo

/mo

Billed annually

-10%

CPU
CPU
4 Epyc Cores
RAM
RAM
4 GB
Space
Space
50 GB NVMe
Bandwidth
Bandwidth
Unlimited
wKVM-NVMe 4096 Windows

18.1 /mo

/mo

Billed annually

-20.4%

CPU
CPU
2 Xeon Cores
RAM
RAM
2 GB
Space
Space
30 GB SSD
Bandwidth
Bandwidth
300 GB
KVM-SSD 2048 HK Linux

18 /mo

/mo

Billed annually

-10%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
150 GB SSD
Bandwidth
Bandwidth
Unlimited
10Ge-KVM-SSD 16384 Linux

231 /mo

/mo

Billed annually

-4.5%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
100 GB HDD
Bandwidth
Bandwidth
300 Gb
wKVM-HDD HK 4096 Windows

17.26 /mo

/mo

Billed annually

-4.8%

CPU
CPU
3 Xeon Cores
RAM
RAM
1 GB
Space
Space
40 GB HDD
Bandwidth
Bandwidth
300 Gb
wKVM-HDD HK 1024 Windows

10.49 /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.