VHD is a nice format for exchanging disks. It doesn’t take up a lot of bytes with the empty space of a filesystem. But if you want to access the data without a virtual machine it can be a bit of a pain.
The attached program will expand most VHD files into a sparse image of the disk. You can then do whatever you wish with that, such as:
- Use it with a virtual machine that takes raw images.
- Convert it to a VMDK with qemu-img from the qemu folk. (Note: some people say qemu-img can read VHD format already. It didn’t work for me and the man page doesn’t mention it.)
Mount it on your Linux box, though you have to skip some bytes to get over the MBR and down to the first partition. Go look at Creating and using disk images mini-howto | Marc’s Realm and find “The dirty way”. Basically it boils down to trying all the plausible offsets until you find the right one:
for ((i=0 ; $i < 10000 ; i=$i + 1)) ; do mount -o loop,offset=$(($i * 512)) image.bootable /mnt && breakdone
Give it a sound grepping.
Note: I don’t support this program or even intend to run it ever again. I converted my data. If you need to convert your data, then enjoy.