Our latest Server Tutorial covers virtual machine conversion tools and takes you step by step through the process of converting a physical machine to a VM.
Currently, there are primarily two tools/products available for converting a physical machine to a virtual machine (VM). While you may find other apps available to perform the conversion, the below products are designed by Microsoft:
- Microsoft System Center Virtual Machine Manager 2012 (P2V)
- Disk2VHD Tool
Microsoft System Center Virtual Machine Manager 2012
Microsoft System Center Virtual Machine Manager (aka SCVMM) not only provides built-in basic options to convert a physical computer to a virtual machine, it also offers advanced configuration options with the P2V wizard. SCVMM is a robust tool for managing virtualization products like Microsoft Hyper-V, VMware and Citrix Xen Servers. We're going to talk more about the Disk2VHD tool in this article, though, so explaining the P2V process of SCVMM is out of scope for this article.
Note: Disk2VHD tool is not a replacement for SCVMM but rather a user friendly tool to perform simple conversions.
While converting physical computers to virtual machines can help organizations reduce their overall physical hardware costs, the enterprise products used for virtual conversion may be expensive. This is where the Disk2VHD tool comes in handy. If you need to perform a conversion without paying a license fee for SCVMM, you can use the Disk2VHD tool instead.
Disk2VHD is a standalone EXE that can be used to convert a physical machine to a virtual machine. Basically, as the name suggests, Disk2VHD converts logical volumes to VHD files. These VHD files can then be used either to create a virtual machine on Hyper-V or attach VHD file as a second drive to the existing virtual machines.
The Disk2VH tool operates in two modes: GUI mode and Command-Line mode. The command-line mode is typically more helpful for scripting-based conversions in which your intervention is not required.
We are going to discuss the following topics in this article:
- Disk2VHD Tool - Using GUI Mode
- Disk2VHD Tool - Using Command-Line Mode
- What Data Is Copied?
- Where Should We Use Converted VHD Files?
- Disk2VHD Facts
Disk2VHD Tool - Using GUI Mode
The Disk2VHD.exe tool can be downloaded directly from Microsoft at: http://technet.microsoft.com/en-us/sysinternals/ee656415.
Before you start the conversion process using the Disk2VHD tool, it is important to shut down all the applications you are running on the physical computer.
1. When you double click on the Disk2VHD.exe, it scans the current computer for all physical drives and shows the available drives for your selection to proceed with the conversion. This is shown in the below screenshot:
Note: The Disk2VHD tool omits network drives attached to the physical computer, as these are not considered for the conversion.
The screen also shows you the free disk space required on the destination location where the VHD file will be created for the drives you have selected.
Note: System Reserved partition (unlettered volume), as shown in the above screenshot, is a bootable partition on the physical computer. Include this partition only if you want to make your VHD bootable. In other words, you may consider including the System Reserved partition if your virtual machine is going to boot from this VHD file.
2. In the same screen, specify the VHD file name and location in the "VHD File Name" text box and then click on the "Create" button to start the conversion process.
3. When you hit the "Create" button, the tool will interact with the Operating System VSS component to create snapshots of the volumes as indicated in the below screenshot:
After the "snapshotting volumes" process is over, the data from the snapshot will be copied to the VHD file.
Disk2VHD Tool - Using Command-Line Mode
Disk2VHD.exe can also be operated from the command line. For example, the following Disk2VHD command can be used to convert a volume to a VHD file:
Disk2VHD.exe <Source Drive Letter> <VHD file name with path>
So to convert your C: drive to a VHD file, use the following command:
Disk2VHD.exe C: C:\MyVHDs\VM1.VHD
Tip: You can specify "*" in place of C: in the above command so that the Disk2VHD tool captures all the drives for conversion.
Tip: By default, when you run the Disk2VHD.exe tool for the first time on a physical computer, you will be prompted to accept the EULA. You can use the "-accepteula" switch to avoid the default behavior as shown in the below command:
Disk2VHD.exe C: C:\MyVHDs\VM1.VHD -accepteula
Note: All volumes you select will be packed into one VHD file unless you are using the command-line option to specify the VHD file name for each drive letter.
What Data Is Copied?
The conversion process copies all data from the logical volumes to VHD files. The Disk2VHD tool also copies the system-specific data such as the computer name, IP Address, MAC Address, Security Identifiers (SIDs), disk signature, etc. Pay attention when using a converted VHD on a network (especially the operating system VHD file). You might see name conflict error messages if the physical computer is still connected to the network and you are using VHD in one of the virtual machines on Hyper-V.
Where Should We Use Converted VHDs Files?
You can attach or use VHD files via one of the following:
- You can create a new virtual machine by selecting a converted VHD file as the virtual disk for the new virtual machine.
- You can attach a converted VHD on the 2nd IDE controller to one of the existing virtual machines.
- You can also browse the contents of a VHD file on the physical computer by attaching/mounting the VHD file using a computer management snap-in or the DiskPart.exe utility.
Disk2VHD Facts / Summary
- Disk2VHD.exe uses Volume Shadow Copy Service (VSS) to perform the conversion. This is achievable only if the VSS service on the physical operating system is running.
- There is no downtime while the conversion is in progress.
- Only physical drives attached to the computer are considered for the conversion. Network drives are ignored.
- Disk2VHD.exe can be used to make a VHD bootable if you have selected the "System Reserved (unlettered volume)" partition before starting the conversion.
- VHD files generated from the Disk2VHD.exe can be used with Hyper-V to create a new virtual machine or the VHD can be attached to an existing virtual machine.
- Since the Disk2VHD tool uses Volume Shadow Copy Service (VSS) for the conversion process, you can specify the local path as the VHD file destination.
- Disk2VHD takes the VSS snapshot of the drives you have selected and then begins the conversion process. This means any new data you save while the conversion is in progress will not be included in the VHD file.
- The tool can be used for simple conversions and is not designed to be a full replacement for SCVMM as discussed above.
- The conversion process may take considerably longer based on two factors:
- The size of the physical disks / partitions you have selected
- The destination location for storing the converted VHD file is the same as the source. Since Disk2VHD.exe performs I/O operations ("Read" I/O for reading data on the logical / source volume and "Write" I/O for writing to the VHD file on the same drive), it will be much slower. It is recommended to specify the VHD file path to a location other than the volumes you have selected.
- Since Windows' "Operating System boot loader" (WinLoad.exe) identifies attached disks by something called a "disk signature," never ever attach the VHD to the same computer, as the generated VHD will also have the same disk signature. This will cause the boot process to hang, or in some cases WinLoad.exe might change the boot order.
- Disk2VHD.exe might not finish the conversion process if any of the applications running on the physical computer put a lock on the disks or files. Backup applications always do this, so it is highly recommended to shut down any backup applications for smooth conversion.
In this article, we discussed the two options available from Microsoft for converting from a physical PC to a virtual machine. We learned how to use the Disk2VHD tool to convert a physical computer to a virtual machine.
We also covered how the Disk2VHD tool can be operated in a GUI mode as well as a command-line mode that can eliminate the need for interventions from the system administrators. The article also explained how the Disk2VHD tool copies system-specific data, including the computer name and other identifiers, as part of the VHD file.
Nirmal Sharma is a MCSEx3, MCITP and Microsoft MVP in Directory Services. He has specialized in Microsoft Technologies since 1994 and has followed the progression of Microsoft Operating System and software. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to Solution IDs for www.Dynamic-SpotAction.com. Nirmal can be reached at email@example.com.
Follow ServerWatch on Twitter and on Facebook