Converting VirtualBox .VDI .VHD .VMDK to bootable .iso file

7.1k views Asked by At

The title is pretty much describe it all.

I thought it would be an extremely easy task but I'm googling the topic for a few days and can not find a proper solution.

I succeed convert it to .iso but it's not bootable from a physical machine.

I have tried:

VBoxManage clonehd file.vdi output.iso --format RAW

I have tried:

VBoxManage clonemedium --format RAW gangina.vdi gangina.img

I have tried:

qemu-img convert -f vpc -O raw gangina.vhd gangina.raw

I have also tried to mount the bootable vdi file and:

sudo dd if={mountedDirectory} of=gangina.iso status=progress

Unfortunately none of them is actually bootable from a physical machine.

2

There are 2 answers

1
TheBossHogg On

You cannot DD with a mounted directory.

You can dd the partition, but it would work better to dd the entire drive.

example: dd sudo dd if={/dev/sda} of=filename.iso status=progress

I am assuming you are on a Linux machine, but when you get it write to a USB and plug it in and boot it. I have used this method before with much success.

While you can do just a partition say sda1 or sda2 dd'ing the entire drive will achieve what you are looking for.

2
Alfred.37 On

You can convert your bootable .VDI .VHD and .VMDK souce to BOOTABLE .iso or .img on follow way on Linux like p.e. Ubuntu, Mint or Debian:

Convert to .iso step 1of2: Convert to .raw:

qemu-img convert -f vdi source_image.vdi -O raw destination_image.raw

qemu-img convert -f vhd source_image.vhd -O raw destination_image.raw

qemu-img convert -f vmdk source_image.vmdk -O raw destination_image.raw

Convert to .iso, step 2of2: Convert .raw to iso:

mkisofs -o destination_image.iso source_image.raw

Convert .vdi to .img

qemu-img convert -f vdi -O raw source_image.vdi destination_image.img

Convert .vhd to .img

qemu-img convert -f vhd -O raw source_image.vhd destination_image.img

Convert .vmdk to .img

qemu-img convert -f vmdk -O raw source_image.vmdk destination_image.img