Convert ISO file to VirtualBox Hard Drive (VDI)

by Stephen Fluin 2009.11.02

When testing different operating systems, configurations, or messing with system settings, it can often be useful to make extra copies or to do testing in a virtual machine. I have been working on a small hardware device that has only 2GB as a linux-based kiosk system. It's only purpose is to boot into a web browser and interact with a couple pieces of hardware.

In order to effectively test, the first step was to make a disk image. I plugged the hard drive (actually a 2GB flash drive) into my main machine and used dd if=/dev/sdc of=/path/to/output/disk-image.iso to make a copy. Warning! this command will erase the destination file/hard drive, and fill it with the contents of the source, so make sure you know what you are doing before you try this.

The Second step was to use the installed virtualbox toolset to make a VDI.

VBoxManage convertfromraw /path/to/output/disk-image.iso /path/to/output/disk-image.vdi

Then, simply create a new virtual machine in VirtualBox (I prefer to use the VirtualBox GUI for this), and attach the .vdi file you just created as a hard drive. Booting, running, and all of the functionality that worked on the physical piece of hardware, should work on the virtual piece of hardware.