Is is possible to convert a .vdi file into a .iso that can be burned to a cd or dvd and make it like an installer. Or Is it possible to convert virtual machines to physical environments?
Yes, and no.
You can convert a VDI into a disk image with the VBoxManage tool. This command clones a registered virtual disk image to another image file. If you want to convert your virtual disk to another format, this is the official VirtualBox tool to use[*].
But... that output IMG file isn't an ISO image, and the OS that's installed will not be configured to run from a bootable CD/DVD. You can "burn" (write) the IMG onto a hard drive, and it might boot on bare hardware (eg not in a virtual machine). But it might not, because the OS installed on that IMG is expecting to see the virtual hardware that VirtualBox provides, and you're booting it on real hardware that it isn't expecting.
Some versions of Windows do not handle this situation well; some Linux distributions do. It is sometimes possible to configure an OS (beforehand or afterwards) to migrate it from one environment to the other like this, but specific steps depend completely on the OS being migrated.
On Windows, you may need to specify the full path to the program:
Add C:\Program Files\Sun\VirtualBox to your PATH to use the short version.
[*] I'm assuming the "--format RAW" option will convert to a standard disk image, as if you'd used the dd command on a physical harddrive. But frankly, I haven't found any documentation that backs this up, so be aware this may not be correct.
[+] I've just tested both commands under VirtualBox 3.1.2. Both output files are identical according to md5sum, but I haven't fully tested the output files.
See also the "All about VDIs" tutorial at the VirtualBox forums.
If your vdi file contains partitions and you want to extract only one of them use the following:
First, as quack quixote said before, convert the vdi file to a raw image file:
Then set up a loop device for the image:
Use kpartx to create devices for each partition in the raw file:
See which devices we have now. In this example, there's only one device as there's only one partition in the raw image:
Now mount it to verify that all works properly:
Use dd to copy the partition contents to a another target partition:
After you're done remove the device mappings again:
The answer is a definite yes, in case your host and guest system is Linux.
It's done with the packages
I do this process in a very fast, with just two lines of command in Linux:
My full article: http://www.previsioni.com.br/jailsonjan/?p=389
I tried the
What worked for me with a Windows 8.1 virtual machine on a Windows 7 host is this:
I don't see this mentioned elsewhere, for a Windows guest I use C:\Windows\System32\sysprep.exe > Generalize > Shutdown on the guest machine before cloning it to avoid trouble with drivers/hardware/registry. On newer Windows versions it may fail unless the "Upgrade" key is deleted from HKLM\SYSTEM\Setup\ otherwise this is a pretty reliable method of migrating a Windows install from one [virtual]machine to another.