Archive for May, 2009

Raw dd image to Virtual Machine disk

May 21, 2009 1 comment

Whilst toying with an HP Thin Client, I took a copy of the internal 1GB flash drive using dd onto a USB flash drive I’d booted (using ubcd 5.0 b12) the device with.

Once you have such a raw dd image of a disk, you have a few ways to convert it into a format usable with VirtualBox,  VMware or Parallels.
Firstly, I discovered that Qemu (there’s a nice Mac port here has a utility called qemu-img.
To convert to the VMware format :
$ /Applications/ convert -f raw -O vmdk sda.dump sda.vmdk
To convert to the Parallels format :
$ /Applications/ convert -f raw -O parallels sda.dump sda.hdd
Or use VirtualBox to convert to it’s format :
/Applications/ convertfromraw sda.dump sda.vdi --format vdi

Once you have the preferred type of file, it is simple enough to boot a virtual machine from the image, or firstly you’ll probably like to use your VM software to compress the image if at all possible :
/Applications/ modifyhd sda.vdi --compact

NB. The ANSI standardised Open Virtualization Format (OVF) will commonly include disk images in the compressed VMDK format.

NB. Download the VMware Virtual Disk Development Kit, which allows you to mount and tinker with the files in VMDK disk images outside of VMware :
vmware-mount sda.vmdk /mnt/loop/

Tags: ,