Terry : VMDK To VDI

Converting VMDK to VDI

VirtualBox VBoxManage

VMDK to VDI using VBoxManage (Recommended)

This command duplicates a registered virtual hard disk image to a new image file with a new unique identifier (UUID). The new image can be transferred to another host system or imported into VirtualBox again using the Virtual Media Manager; see the section called “The Virtual Media Manager” and the section called “Cloning disk images”. The syntax is as follows:

VBoxManage clonehd <uuid>|<filename> <outputfile>
[--format VDI|VMDK|VHD|RAW|<other>]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--existing]

The disk image to clone as well as the target image must be described either by its UUIDs (if the mediums are registered) or by its filename. Registered images can be listed by VBoxManage list hdds (see the section called “VBoxManage list” for more information). A filename must be specified as valid path, either as an absolute path or as a relative path starting from the current directory.

Command

VBoxManage clonehd in.vmdk out.vdi --format VDI

Sample output

$ VBoxManage clonehd micro-disk1.vmdk micro.vdi --format VDI
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 6af484cf-52e3-43db-8a53-eae9ed769739
$ ls -lh
total 4.2G
-rw------- 1 terry terry 2.1G Nov 13 19:54 micro-disk1.vmdk
-rw------- 1 terry terry 2.1G Dec 17 14:41 micro.vdi
-rw-r--r-- 1 terry terry 1.3K Nov 13 19:54 micro.vmx
-rw-r--r-- 1 terry terry 2.9K Nov 13 19:54 README
-rw-r--r-- 1 terry terry 1.6K Nov 13 19:54 RELEASE_NOTES
-rw-r--r-- 1 terry terry   21 Nov 13 19:54 VERSION

qemu-img

VMDK to VDI CANNOT be done directly using qemu, it has to be split into 2 steps:

1. convert vmdk to raw (qemu-img)

qemu-img convert vmware.vmdk raw.bin -p

2. convert raw to vdi (VirtualBox - VBoxManage)

VBoxManage convertfromraw converted.bin outputfile.vdi --format VDI

NOTE: by default the format is VDI.

For compatibility with earlier versions of VirtualBox, the "convertdd" command is also supported and mapped internally to the "convertfromraw" command.

VBoxManage convertdd raw.bin virtualbox.vdi

Sample output => (converting Cloud Foundry micro instance)

$ qemu-img convert micro-disk1.vmdk swap.bin -p
    (100.00/100%)
$ ls
micro-disk1.vmdk  micro.vmx  README  RELEASE_NOTES  swap.bin  VERSION
$ VBoxManage convertfromraw swap.bin micro.vdi --format VDI
Converting from raw image file="swap.bin" to file="micro.vdi"...
Creating dynamic image with size 17179869184 bytes (16384MB)...

qemu-utils

Package: qemu-utils

Description: qemu utilities This package provides some utilities for which full qemu-kvm is not needed, in particular qemu-nbd and qemu-img.

qemu-img - QEMU disk image utility

Supported imaged file formats

  • raw

    Raw disk image format (default). This format has the advantage of being simple and easily exportable to all other emulators. If your file system supports holes (for example in ext2 or ext3 on Linux or NTFS on Windows), then only the written sectors will reserve space. Use "qemu-img info" to know the real size used by the image or "ls -ls" on Unix/Linux.

  • qcow2

    QEMU image format, the most versatile format. Use it to have smaller images (useful if your filesystem does not supports holes, for example on Windows), optional AES encryption, zlib based compression and support of multiple VM snapshots.

  • qcow

    Old QEMU image format. Left for compatibility.

  • cow

    User Mode Linux Copy On Write image format. Used to be the only growable image format in QEMU. It is supported only for compatibility with previous versions. It does not work on win32.

  • vdi
    VirtualBox 1.1 compatible image format. 
  • vmdk
    VMware 3 and 4 compatible image format.
  • vpc
    VirtualPC compatible image format (VHD). 
  • cloop

    Linux Compressed Loop image, useful only to reuse directly compressed CD-ROM images present for example in the Knoppix CD-ROMs.

Reference

VBoxManage