How to convert virtual disks between formats with VBoxManage and other tools

Last update: 21/04/2025
Author Isaac
  • VBoxManage allows you to easily convert VDI, VHD, VMDK and RAW disks from the terminal.
  • Changing the UUID is essential to avoid conflicts when duplicating virtual disks.
  • Tools like qemu-img, PowerShell o VMware Converter expands conversion options.
  • It is vital to check host system compatibility after format migration.

clone virtualbox VM

In the world of virtualization, managing virtual hard drives is a key and frequently repeated task. Converting these drives from one format to another is not only useful for cross-platform compatibility, but also for tasks such as migrations, forensics, or simply facilitating testing in different virtualization software. And if there's one powerful and versatile tool for working with virtual drives, it's VBoxManage.

Whether you use Oracle VirtualBox , VMware, Hyper-V, or even more advanced solutions like QEMU/KVM or Proxmox, knowing how to handle conversion between VDI, VHD, VMDK, and RAW formats gives you a significant advantage. In this article, we'll explain how to convert virtual disks between these formats using VBoxManage and other complementary tools in a precise and detailed manner, leaving nothing out.

What is VBoxManage and why is it important?

VBoxManage is the official command -line interface for Oracle VM VirtualBox. It allows you to perform advanced configuration tasks that are not available through the graphical interface. Key features include:

  • Complete management of Virtual machines: creation, modification, deletion, Boot, off, etc.
  • Detailed control of virtual hard drives: create, modify, clone, convert and more.
  • Interaction with network devices, USB, shared folders, and snapshots.
  • Task automation through scripting and remote control of VMs.

One of the lesser-known but most useful aspects of VBoxManage is its ability to change the format of virtual disks , something vital when we want to move a machine from VirtualBox to VMware, Hyper-V or vice versa.

Most common virtual disk formats

Before getting into the details, it's helpful to understand the main virtual disk formats used by different virtualization solutions:

VDI (Virtual Disk Image)

It's the native format of VirtualBox , widely used for its flexibility and ease of management. It allows for fixed or dynamic storage size, snapshot capabilities, and good performance. It's ideal for testing environments and general use.

VHD and VHDX

These are Microsoft formats primarily used by Hyper-V. VHD is the older version and allows disks up to 2 TB, while VHDX supports up to 64 TB and offers greater resilience to failures thanks to support for 4 KB sectors and recovery from power outages.

  How to install native Linux programs on FreeBSD

VMDK

VMware disk format , compatible with many hypervisors such as VirtualBox and QEMU. It can be monolithic or split, flat or sparse, with support for snapshots and thin storage, and reaches up to 62 TB in modern environments.

RAW

This format, which is not encapsulated and is commonly used in forensics , is simply a byte-by-byte copy of the disk. It's ideal for analysis, data recovery, and compatibility with tools like dd or FTK, although it's not as efficient in virtualized environments due to the lack of metadata.

Converting disks with VBoxManage

VBoxManage allows you to convert disks between different formats using the clonehd or clonemedium commands , specifying the target format. The general syntax is:

VBoxManage clonehd origen.vdi destino.vmdk --format vmdk

can also be used clonemedium, which is the new standard name since recent versions:

VBoxManage clonemedium origen.vdi destino.vmdk --format vmdk

Practical examples:

Convert VDI to VHD

VBoxManage clonehd disco.vdi disco.vhd --format vhd

Convert VHD to VDI

VBoxManage clonehd disco.vhd disco.vdi --format vdi

Convert VDI to VMDK

VBoxManage clonehd disco.vdi disco.vmdk --format vmdk

Convert VMDK to VDI

VBoxManage clonehd disco.vmdk disco.vdi --format vdi

Convert VDI to RAW (forensic format)

VBoxManage clonehd disco.vdi disco.raw --format raw

In all cases, the conversion requires that the virtual disk is not in use and that the machine is turned off.

Disk UUID: How to change it to avoid conflicts

When manually cloning disks by copying VDI, VHD, or VMDK files, problems often arise due to UUID duplication, a unique identifier used by VirtualBox. If two identical disks share the same UUID, you won't be able to use both on the same system.

To change the UUID of a virtual disk, use:

VBoxManage internalcommands sethduuid disco.vdi

This automatically generates a new UUID, allowing it to be used as new without conflicts.

It is also useful when you want to reuse the same disk on multiple machines or distribute it across different environments.

Other tools to convert virtual disks

In addition to VBoxManage, there are several tools that allow you to convert disks between formats, some with additional features.

QEMU-img

qemu-img is the command-line utility included with QEMU/KVM. It allows you to work with disks in the following formats:

  • VDI
  • VHD/VHDX
  • VMDK
  • RAW
  • QCOW2, QED and more

Example of converting VHD to VMDK:

qemu-img convert disco.vhd -O vmdk disco.vmdk

Or to convert to RAW format:

qemu-img convert disco.vdi -O raw disco.dd

To install qemu-img on Linux Ubuntu:

sudo apt install qemu-utils

VMware vCenter Converter

VMware's official tool for converting between formats and migrating physical or virtual machines to VMware environments . It can import VHD, VHDX, VMDK, and even RAW disks.

  What is the OpenF1 API for and how to get the most out of it?

BackupChain

This tool allows for live conversions of running virtual machines, which is very useful for production environments. It supports Hyper-V, VHD/VHDX, VMDK, and direct exports to VMware, even with modified boot compatibility.

Using PowerShell on Windows

Using the Microsoft Virtual Machine Converter (MVMC) snap-in, you can convert disks from PowerShell:

ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath archivo.vmdk -VhdType DynamicHardDisk -VhdFormat vhdx -DestinationLiteralPath destino.vhdx

Important Considerations When Converting Disks

  • It is advisable to shut down the virtual machine before converting the disk.Except for tools like BackupChain, most require idle disks.
  • Choose the target format based on the platform you plan to run the disc on (VMDK for VMware, VHD/X for Hyper-V, etc).
  • Avoid UUID conflicts generating new UUIDs after cloning.
  • Check that the guest operating system can boot on the new platform. May require different drivers or boot settings.
  • Please note that converting between formats may lose metadata., such as snapshots, annotations, or disk chains in more complex environments.

View virtual disk status and information

With VBoxManage you can inspect a virtual disk with:

VBoxManage showhdinfo disco.vdi

This returns information like:

  • UUID
  • Format
  • Original and assigned size
  • Physical route

Modify virtual disks for maintenance

Using VBoxManage also allows you to modify existing disks , using commands such as:

VBoxManage modifyhd disco.vdi --resize 20480

O well:

VBoxManage modifyhd disco.vdi --compact

These commands are used to:

  • Increase disk size (resize).
  • Reduce unused space (compact), after a mass delete.
  • Change access mode (read-only, normal, etc.).

Copies and clones of virtual disks

If you need to clone a disk without changing the format:

VBoxManage clonehd disco.vdi disco2.vdi

In this case, it's duplicated while preserving the original format. You can use it as a starting point for another virtual machine or for non-destructive testing.

Export and import complete machines

VirtualBox allows you to export complete machines in OVA/OVF format, ideal for moving them between systems:

VBoxManage export nombre_maquina -o archivo.ova

And to import it:

VBoxManage import archivo.ova

This includes VM configuration, disks, snapshots, and more. It's a good option when you want to move an entire machine and its entire environment.

  Problem: Cortana cannot be activated in Windows 10

Mount virtual disks on the host system

If you just need to access the data on a virtual disk without starting a VM, you can mount it directly:

On Linux

Using libguestfs:

sudo apt install libguestfs-tools
sudo mkdir /mnt/vhd
sudo guestmount --add disco.vhd --ro /mnt/vhd -m /dev/sda1

On windows

From Disk Management > Action > Attach VHD

This is useful for recovering files or performing forensic analysis without booting the virtual machine.

The world of virtual disk conversion is vast but manageable if you have the right tools and understand each of the formats involved. Using VBoxManage and qemu-img, you can seamlessly switch between VirtualBox, VMware, and Hyper-V, adapting your environments to your needs. The important thing is not only to convert correctly, but also to verify UUIDs, ensure compatibility with the host system, and adapt the disks to each platform. If you follow these best practices and choose the right tool for each case, you will have complete control over your virtual machine disks.

clone virtualbox VM
Related articles:
How to clone a virtual machine in VirtualBox step by step