First off, some background:
I was tasked with creating a way to boot, configure, and save a virtual machine in a format that can be used on a physical hard drive. I accomplished this with Vagrant, Packer, and VirtualBox.
The problem is that in order to use it on a real hard drive, the output .vmdk
needs to be converted to a raw format and written to the hard drive with the dd
utility. The raw format is quite large because there's no shortening of empty space in this format; it's exactly as large as the file system is when it gets generated.
Is it possible to convert the .vmdk
image to raw and pipe it to dd
without expanding it on the writer's file system?
I've tried looking around for any existing solutions, but haven't come up with much. My guess is it's not possible.
For anyone else that might come across this, the solution was (as usual) to RTFM
The qemu-img
utility has this functionality built into it, with a dd
option.
The command is pretty much the syntax of dd
tacked onto the end of the qemu-img
utility parameters.
E.g. qemu-img dd -f vmdk -O raw if=your-image.vmdk of=/dev/sda bs=16M status=progress