Export/convert VDI -> raw image

This is for discussing general topics about how to use VirtualBox.

Export/convert VDI -> raw image

Postby ajd4096 » 8. Nov 2007, 09:28

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

Postby natan » 14. Nov 2007, 20:19

PING is probably a solution for you.
natan
 
Posts: 2
Joined: 14. Nov 2007, 20:13

Postby Ingo » 16. Nov 2007, 17:02

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.
Ingo
Volunteer
 
Posts: 731
Joined: 22. Aug 2007, 10:13
Location: Germany

Postby ajd4096 » 22. Nov 2007, 12:54

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

Postby Rommidze » 23. Nov 2007, 13:52

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   Expand viewCollapse view
dd if=/dev/hda | gzip | ssh user@host 'gzip -d | cat > disk.raw'
Rommidze
 
Posts: 1
Joined: 23. Nov 2007, 13:44

Re: Export/convert VDI -> raw image

Postby bis0n » 4. Mar 2009, 16:00

You can use the following command:
Code: Select all   Expand viewCollapse view
VBoxManage internalcommands  converttoraw file.vdi file.raw


Taken from here:
http://en.wikibooks.org/wiki/QEMU/Images#Exchanging_images_with_VirtualBox

--bis0n
bis0n
 
Posts: 1
Joined: 4. Mar 2009, 15:58


Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 9 guests