How to convert Windows installations to virtual machine images

Martin Brinkmann
Oct 30, 2017
Tutorials
|
8

There are quite a few use cases for wanting to convert a Windows installation to a virtual machine image; maybe you want to run tests on the virtual image afterwards, for instance to run an update to see how it goes. Or, you want to use the image as an option to access data from an old machine that you won't use anymore after the conversion.

Most virtualization products support the conversion of live Windows installations to virtual machine images. Some come with the required tools so that you only need to run them, others are available as third-party programs that you need to run and use instead.

This guide offers instructions on converting Windows installations to Microsoft Hyper-V, VirtualBox and VMware virtual images.

VHDX Format -- Microsoft Hyper-V

convert windows hyper-v vhdx

The conversion of a live Windows system to a Microsoft Hyper-V virtual machine image is very easy thanks to Sysinternals excellent Disk2vhd program for Windows.

The program is portable, and you can run it from any location after you have extracted its archive. The program requires elevation, but can be used to create a virtual machine copy of one, some or all available volumes of the PC it is run on.

Tip: you can run the program from the command line as well using the format disk2vhd <[drive: [drive:]...]|[*]> <vhdfile>.

The application displays the destination path and file name in its interface, and below that the available volumes. Please note that you need to pick a destination with enough free storage space as the process won't complete successfully otherwise.

All that you need to do is select the output path and file name (with the vhdx extension), and pick the volumes that you want to be included in the virtual image.

You can select only the Windows partition if you only need it, or others as well. In fact, you can also turn other partitions into VHD images without selecting the Windows partition.

Disk2VHD comes with two additional options which are both selected on start. The first sets the output format to the newer VHDX format. You can disable the option to create a VHD format image instead.

VHDX offers several advantages such as support for larger virtual disks (64 TB vs 2TB), better corruption protection, 4K disk alignment, online resizing, and more. VHD is needed mostly for compatibility purposes, for instance when a product does not support VHDX but also when you want to convert the image to Virtualbox (see Virtualbox chapter for that).

Tip: Check out Microsoft's article on the differences between VHD and VHDX.

The second option enables the use of volume shadow copy.

Disk2VHD processes the selected volumes and turns them into virtual disk images that are stored in the selected location.

VDI Format --VirtualBox

convert virtualbox windows

VirtualBox comes without option to convert a live Windows environment directly to a compatible virtual disk image.

You can use a workaround however to achieve that. First thing you need to do is create a VHD image as detailed in the Microsoft Hyper-V guide above.

Once you have the VHD image, you may use the vboxmanage command line tool that comes with VirtualBox to clone the medium and save it in a different format.

  1. Tap on the Windows-key, type cmd.exe, hold down the Ctrl-key and the Shift-key, and hit the Enter-key to launch an elevated command prompt.
  2. Navigate to the VirtualBox folder on the system, e.g. c:\program files\Oracle\VirtualBox using the cd command.
  3. Use the command vboxmanage clonemedium disk [source] [destination] to convert the VHD disk image to VDI format. Example: vboxmanage clonemedium disk o:\source.vhd o:\output.vdi

The conversion may take a while depending on the size of the image and the available resources.

VMX Format -- VMware

vmware center converter

You can create VMware virtual images of Windows machines using VMware vCenter Converter. You can download the program from the official VMware website, but it requires an account to do so.

Third-party download sites like Softpedia host the download as well, so download it from there directly and without having to create an account prior to that.

Note: The program creates a virtual image of the full machine. There is no option in the GUI to deselect hard drives or partitions.

The installer has a size of 170 Megabytes, and will display an option to join the customer experience program during installation.

To convert the running Windows system to a virtual image for VMware, click on the "convert machine" option in the program's main interface to get started.

A wizard is loaded; make sure the source type is set to "powered on" and "this local machine". You can create virtual images of remote machines as well, but need to specify the machine's host name or IP address, as well as username and password to do so.

Select VMware virtual machine under destination type on the next  page, and set a destination folder for the image as well on it.

The creation may take a while to complete depending on the number of volumes, size and the device's resources.

Closing Words

It is relatively easy to create a virtual disk image from a Windows installation. The easiest option is offered by Sysinternals' Disk2VHD program as it is lightweight and converts the installation rather quickly to one of the supported formats.

Now You: Do you work with virtual images?

Summary
How to convert Windows installations to virtual machine images
Article Name
How to convert Windows installations to virtual machine images
Description
Find out how to convert a live Windows installation to a virtual machine image; the guide covers Hyper-V, VirtualBox and VMware virtual disk images.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Previous Post: «
Next Post: «

Comments

  1. Jim Garner said on April 20, 2019 at 6:06 am
    Reply

    From the comments and the directions, it remains unclear to me if I will have an Activation issue by going from real Win7 to virtual. Will I?
    I have Win7 64bit on a desktop but I am wanting to move that hard machine into a Linux Mint OS, but every once in a while I might need access to my old Win7 machine, (or a virtual session of it!)

    I intend to run VirtualBox on this linux machine so it sounds like I go VHD then convert to VDI. But I do not want to get half way finished, (or worse… months down the road,) and find out my Win7 license is de-activated and creates a problem.

    Will you please address this here for me and others?

    Thank you for the tutorial !

  2. Graeme said on November 3, 2017 at 7:38 am
    Reply

    Very nice article – something I’ve been wanting to do for ages on old machines with dieing hardware, but machines that run vital services or applications. Many thanks for sharing.

    ps: The screenshots in your article are from Windows? If so what theme have you got installed? It looks really nice.

  3. Clairvaux said on October 31, 2017 at 1:43 am
    Reply

    Very useful article.

    1. Ivan said on October 31, 2017 at 7:36 am
      Reply

      Agreed. Definitely bookmarking this one.
      Thanks Martin!

  4. Hawk said on October 30, 2017 at 1:18 pm
    Reply

    And the opposite, is it possible? Convert a .vdi image to a Windows installation?
    I have a Windows 7 installation that I use at work but would like to turn it into a real installation on my notebook.

    1. mikef90000 said on October 31, 2017 at 12:22 am
      Reply

      My experience is that after converting a virtual disk image to a real partition, Windows will have a Major hissy fit as it detects that it is no longer running on the same ‘hardware’. Pretty much the same scenario going the other way IIRC.

    2. Rumen said on October 30, 2017 at 2:46 pm
      Reply

      You will need to force an MBR table on your hard drive depending on the OS you use.

    3. HK-Rapper said on October 30, 2017 at 2:41 pm
      Reply

      Well an easy solution would be running clonezilla inside your VM and backup the installation to a USB device. Most VMs can expose actual mass storage to a VM.

      Then you restore the image on the notebook.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.