References, Sysinternals
comments 4

Sysinternals’ new tool disk2vhd a.k.a poor man’s P2V

I am a big fan of sysinternals tools and I use these tools quite often to debug OS related issues. These tools are quite useful when you want to understand internals of OS. Mark and his team has been doing a great job in keeping these tools up to date and adding new features once in a while. One such new tool that got released yesterday is Disk2VHD. You can download it here. Here is how TechNet link decribes this new tool.

Disk2vhd is a utility that creates VHD (Virtual Hard Disk – Microsoft’s Virtual Machine disk format) versions of physical disks for use in Microsoft Virtual PC or Microsoft Hyper-V virtual machines (VMs). The difference between Disk2vhd and other physical-to-virtual tools is that you can run Disk2vhd on a system that’s online. Disk2vhd uses Windows’ Volume Snapshot capability, introduced in Windows XP, to create consistent point-in-time snapshots of the volumes you want to include in a conversion. You can even have Disk2vhd create the VHDs on local volumes, even ones being converted (though performance is better when the VHD is on a disk different than ones being converted) 

Disk2VHD dialog

Disk2VHD dialog

I downloaded this tool in the morning and experimented a bit on my Windows 7 system. Usage of this tool is straight forward. You see a dialog with all disk partitions as listed in the screen shot here. All you need to do is select all the partitions you want to export to a VHD and click “Create”. The VHD export will take sometime based on the overall disk size you selected. For my experiments, I just selected first two partitions. This is because I have all the BCD information on partition 1 and without that my new VHD will be meaningless. You may see lot of CPU/memory utilization while the export is in progress. On my system, it looked something like this.

Resource utilization while VHD export

Resource utilization while VHD export

Once the export is complete, I rebooted my system in to Windows Server 2008  R2 and created a virtual machine and attached the exported VHD. That is it. My virtual machine is ready with installed OS and all the applications I was running on the physical Windows 7 system. 

As I powered on the VM, the first screen showed me the boot menu I usually see on my physical machine. This is because I never removed the additional multi-boot entries I had in the BCD stored on first partition.  This entries — if selected — won’t work because I did not export the partitions containing those OS images to the VHD.

VM Boot Menu
VM Boot Menu

At this point, I continued selecting the Windows 7 entry and started booting OS. Within a few seconds, I could see the user selection screen and after I logged in using my regualr user account, I could see all the applications working as usual. I also have Windows Virtual PC with WinXP mode in the VHD image. But — as I expected — that did not work as it requires hardware assisted virtualization which is something that will not be availble inside a virtual machine.

Benifits of Disk2VHD
Like Ben calls it — I stole the phrase from his blog, Disk2VHD is certainly a poor man’s P2V. Anyone can just export the physical disk in to a VHD and then use it inside a VM at no cost. This can be “the” tool for Windows XP migrations to Windows Virtual PC running on Windows 7 OS. One can just capture the existing Windows XP installation and move it seamlessly in to the Windows Virtual PC environment. Then, use MED-V manage updates to the VM. This way, you don’t have to really think about a complete deployment process for your applications running on Windows XP. All this done — except the MED-V part, at zero cost.
 
Gotchas
Of course, enough care has to be taken while bringing these export VHDs live in a network
  • You may see name/ip address conflicts if the physical machine also exists on the network with the same computer name / IP address.
  • There will be some applications tied to the physical hardware identifiers — for licensing purposes. Now, when you move these applications in to VM, they may not work as the physical identifiers are no more available inside a VM.

One thing I am going to explore is to use this tool at the end of sysprep to see if I can capture the syspreped image in to a VHD. Stay tuned for more on that..!

Filed under: References, Sysinternals

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.