Convert vhdx to raw

Tweet about this on Twitter0Share on Facebook0Share on Google+0Share on LinkedIn0

Few days ago I was migrating couple of Windows Server 2012 instances from Hyper-V to OpenStack KVM. The first step was to convert the image from vhdx to raw and then to insert it into OpenStack Glance. Glance is configured to use Ceph as a backend, so raw image is a must.

To convert images from different types I often used qemu-img tool which is a part of qemu-utils package on Ubuntu. I was actually surprised that this tool supports vhdx image conversion. First make sure you are using qemu-utils version 2.0 which is default on Ubuntu Trusty.

This command did the trick:

With the first image this command worked and I was able to run it on KVM. However with second image I had problems, qemu-utils just didn’t work and I was getting bad sector message. First, I thought that there is some issue with image itself. I couldn’t find what was the issue, so I tried to convert it with virtualbox tools. I installed virtualbox:

And then tried to convert vhdx to raw again:

Works like a charm.

Tweet about this on Twitter0Share on Facebook0Share on Google+0Share on LinkedIn0
Posted in Cloud, How to and tagged , , , .

Alen Komljen

I'm a DevOps/Cloud engineer with experience that spans a broad portfolio of skills, including cloud computing, software deployment, process automation, shell scripting and configuration management, as well as Agile development and Scrum. This allowed me to excel in solving challenges in cloud computing, and the entire IT infrastructure along with my deep interest in OpenStack, Ceph, Docker and the open-source community.