Convert RHEV/oVirt to VMware vSphere (raw/qcow2 to vmdk)

I’ve had the pleasure of having to convert our RHEV environment to VMware. With lack of documentation and VMware Converter no longer being supported I took my *nix expertise to do this. I scoured the interwebs and pieced together a few things. What I wasn’t aware of is that RHEV stores the disks in both RAW and QCOW2. Raw is for preallocated disks and QCOW2 is for thin provisioned.

So to preface this, you’ll need to first have either a VM or container running your favorite flavour of *nix. I chose CentOS in a container. I also chose to run this on a Synology we have in the office so that I could set it up as both the export domain, and NFS datastore to make moving files easier.


* Export Domain in RHEV/oVirt
* *nix system with qemu-img installed
* SSH enabled ESXi host (for vmkfstools)


* tmux (helps when trying to run multiple tasks at once)

Without further ramblings, here are the steps…

1. RHEV/oVirt
1. Export VM
2. Check Storage->Disks for UUID of VM disks
1. Alternatively, you can run the command below to see them from your *nix Container
2. *nix VM/Container, Convert Script Below (not in a git repo yet, sorry)
3. Within ESXi shell, run the vmkfstools script below (or manually of course). This will convert it to a proper VMDK and copy it to its final destination. If you don’t copy it with this, then you’ll need to move it yourself. It will also convert adapter type to lsilogic as well as set proper permissions of the destination file.


# Find RHEV/oVirt Image/Disk UUID
find <export domain path> -name ‘*.meta’ -exec grep -H “$1″ {} ;

convert.sh Script

#!/usr/bin/env bash
# convert.sh
#### Image: Raw or QCOW2 image file
#### Destination Name: Name
# This script will convert a RAW or QCOW2 formatted image into VMDK Monolithic Sparse

QEMU_COMPAT=”-o compat6″

function usage {
echo “$0 <image> <destination_name>”

if [[ $# -ne 2 ]]; then
exit 1

if [[ -e $1 ]]; then
IMAGE_META=$(grep -Fq ‘COW’ $1.meta; echo $?)
case $IMAGE_META in
QEMU_COMPAT=”-o adapter_type=lsilogic,subformat=streamOptimized,compat6″
echo “Problem determining type from $1.meta”
exit 1
echo “Converting Image Type : $FORMAT_TYPE”
qemu-img convert -f $FORMAT_TYPE $1 -O vmdk $CONVERT_DIR/$2.vmdk $QEMU_COMPAT
echo “Image not Found”
exit 2


#!/usr/bin/env sh
# vmkfstools.sh
### Source Disk : source disk name without extension
### Destination : Destination Datastore

function usage {
echo “$0 <source disk name> <destination>”
exit 1

[[ $# -ne 2 ]] && usage

echo “Starting….”
vmkfstools -i $1.vmdk -d thin $2/$1.vmdk
echo “Completed.”

echo “chmod….”
chmod 644 $2/$1*.vmdk

echo “sed lsilogic….”
sed -i “s/ide/lsilogic/g” $2/$1.vmdk

View Reddit by RamorousView Source

Related Articles

One Comment

  1. This is a task that I’m going to have to do in the not too distant future, so thanks for this information!

Leave a Reply