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?

link|improve this question

feedback

2 Answers

up vote 12 down vote accepted

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[*].

VBoxManage clonehd file.vdi output.img --format RAW
  • If you're using a dynamic VDI, and you have an older version of VirtualBox, clonehd may not operate properly. VBoxManage's internalcommands tool includes converttoraw, which can convert a dynamic VDI into a raw disk image (source)[+].

VBoxManage internalcommands converttoraw file.vdi output.img

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:

"C:\Program Files\Sun\VirtualBox\VBoxManage.exe" [...]

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.

link|improve this answer
Thanks for the answer. I'll try this when I have time – Ieyasu Sawada Feb 28 '10 at 7:06
What about the size of the VDI? Does that matter? Let's say the VDI size is 20GB and the actually HDD size is 200GB... What would happen? – ultimatebuster Dec 12 '11 at 17:49
feedback

The answer is a definite yes.

Converting a virtual disk image: VDI or VMDK to an ISO you can distribute http://www.turnkeylinux.org/blog/convert-vm-iso

link|improve this answer
+1 "definite" with the caveat "..as long as your guest is linux". and their (your?) solution relies on some TurnKey Linux tools. but the procedure looks sound. (welcome to Super User!) – quack quixote Feb 28 '10 at 10:54
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.