I have recently downloaded a Linux operating system for testing. The downloaded OS 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 command to convert the IMG file to VDI file. VDI file, 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 Using 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 modern GNU/Linux operating systems.
Once VirtualBox installed, go to the location where you have 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.
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)...
It will take a few moments to convert IMG file to VDI.
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".
Next assign the Memory size to the Virtual Machine.
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 an click Create.
That's it. Now, start exploring the Virtual Machine.