Page 1 of 1

Export/convert VDI -> raw image

Posted: 8. Nov 2007, 09:28
by ajd4096
Any suggestions on exporting a virtualbox image back into a raw image?

I've read the threads which suggest searching for the start of the partition and mounting it via a loop-back.

I've tried using "dd bs= skip=" to create a raw image which starts with the boot-sector/partition table, but (eg) qemu won't boot from the image.

My VDI file is only 3G for a 4G disk image, but I can't see any way to "uncompact" it.

Posted: 14. Nov 2007, 20:19
by natan
PING is probably a solution for you.

Posted: 16. Nov 2007, 17:02
by Ingo
Hi ajd4096,
"dd bs= skip=" should do the thing to get out the raw data. But I think it's only the partition data. I don't know qemu but maybe it needs a complete raw disk containing master boot record, partition table and partitions.
If you give PING a try please tell us if you can get out the complete raw disk, including partitions.

Posted: 22. Nov 2007, 12:54
by ajd4096
Ingo wrote:Hi ajd4096,
"dd bs= skip=" should do the thing to get out the raw data. But I think it's only the partition data.
No, I was careful to identify the very 1st sector of the disk. The problem was the VDI had been compacted and there is no way to uncompact it, hence the VDI is missing some of the (empy) sectors when read from outside the VM. From within the VM these sectors are handled by virtualbox, so the livecd approach is definitely the answer.

I ended up booting the virtualbox VM using a sidux-based livecd image and doing
dd if=/dev/hda | ssh user@host 'cat > disk.raw'
which only took a few minutes and worked just fine.

Posted: 23. Nov 2007, 13:52
by Rommidze
ajd4096 wrote:I ended up booting the virtualbox VM using a sidux-based livecd image and doing
dd if=/dev/hda | ssh user@host 'cat > disk.raw'
which only took a few minutes and worked just fine.
Little improvement which boosted the same operation for me about ten times:

Code: Select all

dd if=/dev/hda | gzip | ssh user@host 'gzip -d | cat > disk.raw'

Re: Export/convert VDI -> raw image

Posted: 4. Mar 2009, 16:00
by bis0n
You can use the following command:

Code: Select all

VBoxManage internalcommands  converttoraw file.vdi file.raw
Taken from here:
http://en.wikibooks.org/wiki/QEMU/Image ... VirtualBox

--bis0n