Wednesday, July 1, 2015

Converting VMWare Disk Images For Use With QEMU

At my current job we have a VM that was created by someone using VMware which hosts a scaled down version of our runtime environment. Being the new guy, and someone who's way more comfortable with Fedora Linux than Windows, I wanted to take the VM and run it on my favorite OS.

But I couldn't just copy the image over since the 60G disk was split up into 31 separate VMDK files, which cried out to be converted to a format usable by Linux.

So here's what I did:

 $ for vmdk in *.vmdk; do qemu-convert -f $vmdk -O raw $(basename -s .vmdk $vmdk).img; done
 $ cat *.img >> runtime_environment_vm.img

When it was all done I had a bootable disk. I created a new VM using that disk and was off to work in no time!