Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

Recently my Xen server has been retired and taken away for recycling, but the disk images that were running the VMs remained on the external drives that I've been using with it. I've needed to use one of these VMs, but with the Xen server gone I had no way other than to convert everything to VMware to run on my Mac. It took some time to do the disk image conversion (6 days for a 200Gb disk!), but it did get there in the end and the VM works perfectly off of my laptop now.

Doing some research on how to convert a raw disk image (.img file) to a VMware virtual disk (.vmdk file) indicated that I needed qemu-img for the task. This is not installed on OSX by default, but there is a project that ports QEMU to OSX here: http://www.kju-app.org. This is the whole QEMU package, what I needed was just the qemu-img utility.

To get to the qemu-img utility needed to go via the Terminal into the package contents, the utility is found here:

To do the actual conversion, I ran the following command:
./qemu-img convert -f raw -O vmdk /Volumes/xxx/rawdisk200gb.img /Volumes/xxx/vdisk200gb.vmdk

This converted the raw disk image to a VMware disk image. I've tried a small disk image of 10Gb, which took only around 10mins to convert, however the large image of 200Gb took 6 days, but it would all depend on how the data was laid out on the original disk.

Something I noted is that the qemu-img help screen you get when you run the utility without parameters gives misleading information that suggests that the -f and -O parameters should have the file names for the disk images immediately after each one of them, but the reality is you have to specify these parameters first, then specify both the disk image file names as above.


A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.