Reference Guide: Optimizing Backup Strategies for Red Hat OpenShift Virtualization

virt-v2v is a command utility tool that converts an entire virtual machine (VM)—whether it be Linux or a Windows-based guest—from a hypervisor such as VMware to a kernel-based virtual machine (KVM). The utility can modify the VM guest to make it bootable on KVM and install virtio drivers, allowing it to run seamlessly.

This article provides an in-depth explanation of virt-v2v, covering prerequisites and setup, best practices, and the actual process of VM conversion and migration. Note that this article does not cover the installation and configuration of a VM and its hypervisor; it is recommended that you have an existing VM to convert and experiment with while following some of the steps in this article. Also, while virt-v2v supports multiple VM source platforms, this article primarily focuses on migrating VMs from VMware to KVM.

Summary of key steps for VMware to KVM migration using Virt-v2v

Step

Description

Export the VMware virtual machine

The initial phase involves preparing the source VM (powering down, ensuring consistent state, etc.), removing unnecessary VMware drivers, and exporting the disk files (e.g., .vmdk) in a format accessible for conversion.

Run the virt-v2v conversion

This is the core technical phase where the virt-v2v utility is executed to convert the exported proprietary disk image into a KVM-compatible format.

Validate and test the migrated VM

The final phase ensures that the VM is production-ready and drivers are loaded correctly in the target KVM environment.

Automated OpenStack & OpenShift Data Protection & Intelligent Recovery

Enjoy native OpenStack integration, documented RESTful API, and native OpenStack CLI

Restore Virtual Machines with Trilio’s One-Click Restore

Select components of your build to recover via the OpenStack dashboard or CLI

Prerequisites and setup

Before we can get started, let’s discuss what you will need to start using virt-v2v.

Supported guest operating systems

Here are some of the main OS families supported for guest OS conversion and migration according to the official virt-v2v documentation.

Linux distributions:

  • Red Hat Enterprise Linux (RHEL) 4, 5, 6, 7, 8, 9, 10
  • SUSE Linux Enterprise Server 11 SP4 and later
  • SLES 10 and up
  • SLES 15
  • Debian (6 and up)
  • Ubuntu (various versions)

Windows operating systems:

  • Windows 8 / 8.1 / 10 / 11
  • Windows Server 2008 / 2008 R2 / 2012 / 2012 R2 / 2016 / 2019 / 2022 / 2025

Host virt-v2v installation

The package requires a Red Hat 64-bit Linux host system. Once you have confirmed that you have the right architecture and OS, run the command below as a root user:

yum install virt-v2v

The base virt-v2v package is all you will need when converting a Linux guest, but there are other requirements if you are converting a Windows guest. Per the official Red Hat virt-v2v documentation, you must also install the libguestfs-winsupport and virtio-win packages.

The command below will install the additional packages required for Windows conversion and migration:

yum install libguestfs-winsupport virtio-win

The migration will not work if the additional packages are not installed.

As a best practice, always check for sources and documentation to ensure the installation of newer versions and updates for compatibility. If virt-v2v is already installed on your machine, you can upgrade the virt-v2v package with the following command:

yum update virt-v2v

Learn how Trilio’s partnership with Canonical helps better protect your data

Methods for exporting source VM data

Once virt-v2v is installed, you can start preparing to export the source VM data. There are two main methods for accessing a source VM’s data to initiate the conversion: online and offline.

Method 1: Direct (online) connection

This method starts by having virt-v2v connect to the vCenter or a standalone ESXi host by using the VMware APIs as the backend. Once a connection is established, the command utility locates the VM and copies the disk data over the network.

Most administrators prefer this method because it is straightforward and easy to use.

Method 2: Offline conversion

In contrast to the first method, offline conversion involves one additional step. First, virt-v2v will export the VM as an OVF or OVA package. Once exported, the files will be referenced to virt-v2v as the source file for conversion.

Since you will first export the VM as a package, the process will consume more time and storage space. However, there will be certain use cases where an offline conversion is a must, like environments with a stricter and closed network where direct connection is prohibited.

Comparison of methods

For easier comparison, here is a simple table to guide you on which method to use.

Criteria

Direct (online) connection

Offline conversion

Network access to VM

Required

Not required

Speed of conversion

Faster

Slower due to an additional export step

Storage space requirement

Lower

Higher (requires space for exported files)

Process complexity

Simpler (one-step process)

More complex (two-step process: export then import)

From this point, you should decide what method to use. Later in this article, you will learn how to use these methods as we provide a few example commands for you to follow.

VM state requirements

While you decide on which export or access method to follow, you must ensure that the source VM is powered off to preserve data integrity and to avoid data loss and corruption. Virt-v2v operates on powered-off VMs, as it must read the disks in a stable and unchanged state.

Exporting or converting a powered-on VM is like photocopying a book while someone is still writing in it. The process will capture files on disk in an inconsistent state and miss all the data still in memory. So make sure not to miss this step, particularly as the next section walks through the actual conversion process.

Learn about the features that power Trilio’s intelligent backup and restore

Running the virt-v2v conversion

Now we will look at the basic syntax and parameters for using virt-v2v.

Syntax of the virt-v2v command

Running virt-v2v requires primary parameters, which include the input method, where you will define the location and the access method for your source VM and the output method for its destination.

virt-v2v [OPTIONS] -i <INPUT_METHOD> [INPUT_ARGS] -o <OUTPUT_METHOD> [OUTPUT_ARGS]

Here are the main parts of the command:

  • [OPTIONS]: Flags that modify the conversion. Common flags include:
    • -v: Verbose; prints detailed information about the conversion
    • -x: Enables XML parsing (often needed for vCenter URIs)
    • –password-file: Specifies a file containing the password for the source (e.g., vCenter, ESXi root)
  • -i <INPUT_METHOD>: Specifies the source of the VM
  • [INPUT_ARGS]: The name or URI of the VM you want to convert
  • -o <OUTPUT_METHOD>: Specifies the destination or “output mode”
  • [OUTPUT_ARGS]: Output configuration, such as specifying the storage pool (-osd) or network bridge (-ob)

Please note that these are not the only flags supported by the virt-v2v utility; it has multiple customizations that you can use for your specific use cases. You may wish to refer to the virt-v2v official documentation for the complete parameter list.

Explanation of input/output formats

For VMware to KVM conversions, these are the only input and output formats that you will have to remember.

Common input methods (-i)

vCenter / ESXivpx/esxiConnects directly using a vpx:// (for vCenter) or esxi:// (for standalone ESXi host) URI
VMware VMXvmxReads from a local .vmx configuration file and is used when converting from an exported OVF/OVA package
VMware OVAovaReads directly from a single .ova archive file

Common output methods (-o)

LibvirtlibvirtCreates a libvirt domain (a VM definition) and converts the disks into the specified storage pool (-osd)
QEMUqemuConverts the disk images into a target format (like qcow2) and places them in a directory specified by -osd but does not create the libvirt XML definition

Examples of converting from VMware to KVM

Once you have learned the basic syntax, you can now put it into practice and perform the conversion. As previously mentioned, there are two primary methods when converting and migrating from VMware to KVM: a direct connection to vCenter or ESXI host or an offline conversion from exported VM files.

Example 1: Direct access conversion (from vCenter/ESXi)

This method involves virt-v2v connecting directly to the VMware vCenter server to pull VM data over the network.

virt-v2v -ic "vpx://[email protected]/Datacenter/Host" "vm_guest" -o libvirt -osd default

Command breakdown:

  • -ic vpx://: This is the input method:
    • -i specifies the input. The c is a helper flag that connects to the libvirt instance.
    • [email protected]/Datacenter/Host is the URI that points to the VM. You must specify the username, vCenter/ESXi host, datacenter, and cluster/host.
    • Authentication is required to connect to the VMware vCenter server. You may pass the password value at the time of conversion or using the –password-file <path> option.
  • “vm_guest”: This is the hostname of the VM you want to convert.

For VM sources that are hosted in standalone ESXi hosts, all you have to do is change the input method prefix to esxi:// as follows:

virt-v2v -v -x -ic vpx "esxi://[email protected]/MyVM?no_verify=1" ...

Notice that the URI for ESXi connections contains additional strings at the end. The “?no_verify=1” flag is almost always required for standalone ESXi hosts, as they use self-signed SSL certificates by default. This flag tells virt-v2v to skip the certificate check.

If you are using a self-signed SSL certificate on your vCenter, you may also append the same flag to your vCenter VPX URI.

Example 2: Offline conversion

If you used the offline process and exported the VM to an OVF/OVA package, you can perform the conversion by defining the path where the VM files were exported, as shown below.

virt-v2v -v -x -i vmx /path/to/export/MyVM/MyVM.vmx  -o libvirt -osd default
virt-v2v -v -x -i ova /path/to/export/MyVM/MyVM.ova -o libvirt -osd default

Validating and testing migrated VMs

Now that you have finished the conversion process, you have to make sure that the migrated VMs are healthy. To help, this section has laid out a few best practices on post-migration validation steps that you can follow, but note that this may not be a complete list, and you may add more checks that align with the needs of your organization.

Boot verification

Start the VM and ensure that it boots up without any issues.

Network connectivity

Check that all network interfaces are detected and set up. Test both internal and external network connections using ping or similar tools.

For Windows guests, open the Device Manager console and verify that the virtio drivers are installed without any issues. If you see any device with a warning icon signified by a yellow exclamation mark, reinstall the virtio-win package.

Disk and file system integrity

Make sure all disks and volumes are present, and run file system checks to confirm data integrity.

Performance benchmarking

After the operation, immediately start monitoring VM metrics and observe if there is anything unusual with their utilization. If you have benchmarks collected before you started the migration, it is also good to compare just to make sure that the VMs haven’t degraded in performance after the platform move.

Limitations and troubleshooting

You should be aware that activities involving live workloads have a potential risk due to some limitations imposed by the tool. To assist, this section lists out commonly known limitations and issues reported by third-party vendors and administrators that you may also face during and after the operation. Like the previous section, this may not be a complete list, and edge cases may occur in your own experience.

Unsupported features

Certain VMware-specific features, like VMs with linked clones or VMDKs that are encrypted, are not supported for conversion.

Guest OS restrictions

Older operating systems that lack virtio support may require legacy device emulation, resulting in lower performance. On the other hand, newer operating systems that are supported by virt-v2v may not be properly converted when executed on an older RHEL 7 system. So always make sure to check the compatibility matrix before proceeding.

Dynamic disk configurations

Dynamically allocated or thin-provisioned disks may expand to full size during conversion, consuming additional storage, so plan your conversion accordingly, especially when doing offline conversion operations.

Licensing dependencies

Windows guests may require reactivation after migration due to hardware abstraction changes, so make sure that you double-check your VMs after conversion and prepare your environment for operating system reactivation.

Find out how Vericast solved K8s backup and recovery with Trilio

Final thoughts

virt-v2v, as a utility, is a robust tool for performing cross-platform VM migrations for most administrative tasks. However, organizations undertaking enterprise-scale migrations from VMware to OpenStack face additional challenges around minimizing downtime, ensuring consistency across large VM fleets, and maintaining business continuity throughout the transition. 

Trilio’s in-band approach to VMware migration helps organizations implement an effective organization-wide migration strategy. Trilio’s tenant-driven workflows discover VMware workloads and extract their data and associated metadata, then create these resources on the OpenStack platform while giving users maximum flexibility to remap VMware constructs to OpenStack constructs. Users can repeatedly execute migration plans until they are 100% confident that migration workloads meet their business needs.

Explore Trilio’s VMware to OpenStack migration capabilities.

Table Of Contents

Like This Article?

Subscribe to our LinkedIn Newsletter to receive more educational content

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.