Home Oracle VirtualBox How To Convert IMG File To VDI File Using Oracle VirtualBox In Linux

How To Convert IMG File To VDI File Using Oracle VirtualBox In Linux

By sk
Published: Last Updated on 31.5K views

The other day I downloaded a Linux operating system for testing. The downloaded OS image was in IMG format, and Oracle VirtualBox doesn't support the IMG format. So, I had to find a way to use IMG file in VirtualBox. After a bit of google search, I found a simple way to convert the IMG file to VDI file using Virtualbox in Linux. Read on.

What are VDI and IMG files?

VDI file, stands for Virtual Disk Image, is the default disk image file for VirtualBox. In layman terms, VDI is the virtual hard disk of a guest machine. Unlike physical hard disk, we can expand the size of virtual hard disk without losing any data. The disk image files can be created either in fixed size or dynamically allocated size.

IMG file, also known as Image file, that can be used to distribute the whole image of a disc. It is similar to ISO file. It is mostly useful for dumping the video games. We can mount the IMG files in the computer and play the games without having to burn them in a physical disk. Not just games, we can write operating system and applications in IMG format. IMG is the default disk image format for QEMU, an open source virtualization software.

Hope you got the basic idea about VDI and IMG files. Now, let us see how to convert IMG file to VDI file using VirtualBox.

Convert IMG file to VDI file with Oracle VirtualBox

You must install Oracle VirtualBox before starting to convert the IMG files. Oracle VirtualBox is a cross-platform virtualization software. It is available in the default repositories of many GNU/Linux operating systems.

Once VirtualBox installed, go to the location where you have downloaded the IMG file.

The syntax to convert a IMG file to VDI file is:

VBoxManage convertdd input.img output.vdi


$ VBoxManage convertdd eos-eos3.0-amd64-amd64.161024-144409.base.img eos.vdi

Replace the img file with your own file.

Sample output:

Converting from raw image file="eos-eos3.0-amd64-amd64.161024-144409.base.img" to file="eos.vdi"...
Creating dynamic image with size 6012964864 bytes (5735MB)...
Convert IMG to VDI file format
Convert IMG to VDI file format

The image conversion will take a few moment depending upon the size of the image file. The resulting image file will be saved in the current working directory.

Import VDI file in Oracle VirtualBox

Open Oracle VirtualBox. Click New on the Menu bar to create a new Virtual machine.

Enter the name of the virtual machine. I named it as "Test".

Enter Virtual machine name and type
Enter Virtual machine name and type

Next assign the Memory size to the Virtual Machine.

Assign memory to VM
Assign memory to VM

Here comes the important part. As we already have created the virtual hard file (VDI), you must select the option "Use an existing virtual hard disk file". Choose the VDI file location and click Create.

Select the VDI file location
Select the VDI file location

That's it. This is how we convert IMG file to VDI file format in Linux. Now, start exploring the Virtual Machine.

You May Also Like


Brandon March 1, 2018 - 7:54 am

This is only for .IMG formats? or can i converter .iso to .vdi?
Thanks for the post, you save me!

01101001b October 4, 2018 - 10:41 am

Thank you so much for this tip! It reaaaaally helped me a lot.

Rares Vlad POP February 21, 2019 - 10:52 am

i get this error:

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (4.20.8-110.current) or it failed to
load. Please recompile the kernel module and install it by

sudo /sbin/vboxconfig

You will not be able to start VMs until this problem is fixed.
Converting from raw image file=”batocera.img” to file=”batocera.vdi”…
Creating dynamic image with size 1992938496 bytes (1901MB)…

I use Solus


Josef April 20, 2022 - 11:55 pm

Note that converting an IMG file that has “multiple” partitions does work using this method. All partition info is lost. It simply creates a non-partitioned disk VDI file. i.e. /dev/sda

sk April 21, 2022 - 11:16 am

Thanks for the heads up.

Gunnar Gervin October 10, 2022 - 6:24 am

You did not tell how to put the vdi file somewhere in the system. Seems it was converted but since no location was specified, Virtualbox cannot find it. Would have been more impressed if the .img file had been changed to a .vdi file. Impossible or not?

sk October 10, 2022 - 11:31 am

The VDI file will be saved in the current working directory. You need to manually choose the path of the VDI file to import it.


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More