Doing P2V with HyperV

I had recently tried to use my Windows Home Server to restore a laptop image to a VM running inside HyperV. 

In the event that my machine totally died (not just a hard drive issue) I could restore the image to a VM and work from there while I got back on my feet with a new laptop.

Unfortunately I didn’t find any way to make this work.  I ended up doing all this work and in the end, I couldn’t boot.

A disk read error occurred
Press ctrl+alt+delete to restart.

I tried everything I could think of, repairing the MBR, running fixboot, doing a windows repair, restoring the hal dll from i386 etc.  Nothing worked.

So I gave up on using WHS to create an instance of my dev machine, and fell back on just trying to do a P2V of any type.

I came across Disk2VHD, a free Systernals tool.  This tool includes the options to run on the source machine while online, and also provides an option to “Fix” the HAL (hardware abstraction layer).  I think this was part of my original problem (the HAL issue).  My computer was setup to use SATA drivers, and HyperV only supports virtual IDE drivers.  I think (but am not sure) that this is what was causing my problem w/ using the WHS restore.

So anyway, Disk2VHD runs super fast, and pretty soon I had a VHD to try out. 

Now, this VHD didn’t work either, but it would get me further along.  I would see the windows splash screen before the black screen of death.

What followed was a weird set of steps trying to figure out why things wouldn’t work, but in the end, I never ended up needing to disable anything…. so I’m just going to try to write down the steps I took as best I can.

  1. After the first BSOD I booted to safe mode (using F8).
  2. Safe mode worked, and it seemed to find some new hardware, as I would have expected, but I don’t think it found any of the drivers it needed (so maybe I had ejected the virtual windows CD or something).
  3. Booting normally gave the black screen of death again.
  4. I then found this page with instructions on how to replace the HAL.  Really these instructions were how to do Disk2VHD to a working VM, but I had already done most of the steps except the hal replacement.  I’m going to replace those instructions below:
    1. 1)Downloaded Disk2VHD (v 1.3) from sysinternals (free) and unzipped on the laptop
      2)Find a place to store the new vhd – I used a 320GB external USB, but any storage device that pc can see and is big enough to hold your hard disk should work
      3)Run Disk2VHD and input the name and location for the new file
      4)On your virtual host create a new VPC (I use Virtual PC 2007) and add that new vhd you just created as the primary hard disk.
      5)Make sure you have an ISO of WinXP or an actual disk. If using an iso you’ll need to mount it so it can be booted from.
      6)Fire up the new vpc and have it boot from that XP disc.
      7)Let it run setup and then select option 2 (R) to get repair console
      Login in to windows (need admin pw)
      9)Type “cd system32” press enter
      10)Assuming your CD (or mounted iso) is drive D – Type “expand d:i386halacpi.dl_” press enter
      11)Type “copy halacpi.dll hal.dll” press enter and then press y
      13)Press F8 to get to safe mode
      14)After the message that new stuff was installed, click OK for reboot
      15)After system boots back up, log in and install VM Additions
  5. IIRC I still got the black screen of death.  It’s possible that at this point behind the scenes it was doing a check of my disck or something, but I can’t tell in the VM if the HDD is going or not so I just assumed it was locked.
  6. I booted to safe mode and used MSconfig to disable everything, and also used /SOS, and some other options.
  7. What followed was just a series of successful boots with me enabling more and more until I had everything enabled and it all still worked, so I’m not sure why I was getting the BlackSOD before I started this set of SafeMode boots.
  8. Another thing I did at some point (maybe more than once) was try to install the VM Integration Services, which says that it’s updating the HAL, so maybe that had something to do with it too.

The next 2 things that I’m going to try are, running a WHS restore to a VM that is already working (I don’t think this will matter, but we’ll see), and 2 trying to use the Disk2VHD on a machine that has a VHD mounted as a secondary drive.  I don’t konw if this is even possible, but I was thinking that I could use WHS to create the VHD, mount the VHD as X: on some machine, and then tell Disk2VHD to create a VHD from X: and instruct it to to the “Fix HAL” thing.  I’m guessing that will not work as well, but we’ll see.



One thought on “Doing P2V with HyperV

  1. I believe the problem you have is the disk size is larger than what Virtual PC will allow for. What I did was to attach the VHD on my Windows7 laptop and compact it, bring the size down to under 30GB and I was able to boot sucessfully

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s