Export/convert VDI -> raw image

This is for discussing general topics about how to use VirtualBox.
Post Reply
ajd4096
Posts: 4
Joined: 7. Nov 2007, 01:51

Export/convert VDI -> raw image

Post 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.
natan
Posts: 2
Joined: 14. Nov 2007, 20:13

Post by natan »

PING is probably a solution for you.
Ingo
Volunteer
Posts: 731
Joined: 22. Aug 2007, 10:13
Location: Germany

Post 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.
ajd4096
Posts: 4
Joined: 7. Nov 2007, 01:51

Post 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.
Rommidze
Posts: 1
Joined: 23. Nov 2007, 13:44

Post 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'
bis0n
Posts: 1
Joined: 4. Mar 2009, 15:58

Re: Export/convert VDI -> raw image

Post 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
Post Reply