Disk2vhd is tool from Microsoft’s Sysinternals group that allows system administrators to create virtual hard disk images (VHD) of running operating systems loaded on physical hardware.
VHDs are the Microsoft’s Virtual Machine disk format used in Microsoft Virtual PC or Microsoft Hyper-V virtual machines (VMs).
There are other physical-to-virtual tools that are available to create images out of installed operating systems running on physical hardware; the main advantage of the Disk2vhd tool is that you can run it on a system that is up and loaded as it uses the Windows’ Volume Snapshot capability to create a point-in-time snapshot of the volumes you want to include in a conversion.
The Disk2vhd tool also allows for the ability to create the VHDs on other local volumes including the active one being converted.
[NOTES FROM THE FIELD] – While the tool does allow you to create the file in this manner there is a performance hit; it is always better to create the VHD is on a different physical disk.
Once you download the tool from the Microsoft Website (which still shows as a Sysinternals download point at http://download.sysinternals.com/Files/Disk2vhd.zip) you would open the ZIP file to expand the files to a location to run them.
Once that is done you would run disk2vhd.exe and accept the Sysinternals Software License Terms which would then bring you to the application’s main view.
The default view of my physical system is shown below. You’ll notice that the tool automatically selects all of the available drives and sets a default location and name where to drop the VHD file if you were to accept the defaults and select CREATE.
Since a couple of these partitions are just data and others are alternate operating systems rather than my base image that I am currently running (Windows 7 Ultimate Edition x64) I am going to clear all the defaults with the exception of the C:\ which is where my Windows 7 install resides.
I would like to avoid the performance hit so I will change the default file location to my DATA drive.
Once I have made the changes and hit the CREATE button you’ll notice the progress bar will begin and it will create an empty file holder at the destination directory as it builds as shown in the second image below just above the active application window.
Once the image is created you’ll see that its actual size is shown and it is ready to be mounted within the Virtual PC environment.
I am running the Virtual PC environment of Windows 7. When I attempt to walk through the steps to mount the virtual machine under Virtual PC in the sequence of steps show below you’ll notice I have a critical failure and cannot continue.
This is because Virtual PC doesn’t support the Multiprocessor Specification and it will not be able to boot VHDs captured from multiprocessor systems.
In order to boot this successfully I would need boot my Server 2008 system running Hyper-V in order to mount the VHD (after configuring everything necessary in the Hyper-V Manager as shown below).
Briefly, it is important to note what is supported under the tool and what are the recommended operational boundaries.
Usage: disk2vhd <[drive: [drive:]…]|[*]> <vhdfile>
Example: disk2vhd * c:\vhd\snapshot.vhd
In this tutorial we took an overview look of the Disk2vhd tool and also reviewed some of the best practices.
Additionally we walked through running the tool and collecting an image from a hardware build as well as reviewed the failure we received when we tried to launch a multiprocessor image capture on Virtual PC due to the limitations of that desktop product.
I am always looking forward to any feedback you have on this or any of the articles I have written so feel free to offer your feedback.
Additionally, I would welcome any suggestions topics of interest that you would like to see and based on demand and column space I’ll do what I can to deliver them to you.