virtualization - Converting offline Windows 8 to VHD for Hyper-V (p2v)
2013-08
here's my current config:
- I have an offline SSD with a single ~240Gb partition that was running in my old laptop.
- I no longer have access to the laptop.
- I have a new eSata enclosure and would like to boot from a VHD of the old image, externally, running on my new Win8 machine using Hyper-V.
I would like to know if:
- This is possible with current tools,
- If anyone could recommend a utility to do the p2v conversion on the disk.
I checked DiskToVHD from sysinternals, but it says it only supports up to 128Gb partitions. I found a couple of other utilities, but couldn't find confirmation that they supported Win8.
Create a VHDX using the Disk Management MMC that is at least as large as your SSD. Attach the VHDX. Then use something like DriveImage XML to copy the SSD to the VHDX. Once that is complete, detach the VHDX, create a new VM and attach the VHDX instead of creating a new one.
I have a virtual machine running Windows 2008 R2 x64 as guest, and Hyper-V R2 x64 as host.
I have cloned the vhd file of the virtual machine, and now, I want to boot from it directly on my laptop computer, which a Windows 7 Enterprise X64 SP1 (with hardware virtualization).
For that, I've set up a BCD entry :
bcdedit /copy {current} /d "Boot_From_VHD"
The entry was successfully copied to {1230b942-0833-11e1-abb2-d1169c7203ba}
bcdedit /set {1230b942-0833-11e1-abb2-d1169c7203ba} device vhd=[E:]\vhd\myvhd.vhd
bcdedit /set {1230b942-0833-11e1-abb2-d1169c7203ba} osdevice vhd=[E:]\vhd\myvhd.vhd
bcdedit /set {1230b942-0833-11e1-abb2-d1169c7203ba} detecthal on
Running bcdedit /enum
, I can see my entry :
Windows Boot Loader
-------------------
identifier {1230b942-0833-11e1-abb2-d1169c7203ba}
device vhd=[E:]\vhd\myvhd.vhd
path \Windows\system32\winload.exe
description Boot_From_VHD
locale en-us
inherit {bootloadersettings}
osdevice vhd=[E:]\vhd\myvhd.vhd
systemroot \Windows
resumeobject {1230b940-0833-11e1-abb2-d1169c7203ba}
nx OptIn
detecthal Yes
When I reboot, I can see the entry in the boot menu. If I select the newly created entry, I can see for a few seconds the windows logo, then a BSOD.
This BSOD is not very useful as it's only suggesting to run a chkdsk
. A bunch of 64 bits hexadecimal numbers are also put, but with no error message.
Any idea how to solve the problem ?
PS: I want to keep my system intact except the potential hardware changes. I have not run sysprep /generalize
as it will reset all users, hostname, etc.
I finally solved my problem.
The BSOD states error STOP: 0x0000007B
, which means inaccessible boot device
.
This puts me on the way of missing drivers. Actually Hyper-V machines use IDE emulation, and I suppose only IDE drivers are available in the image, while my laptop use a eSata drive.
To solve the problem, I use DISM /add-driver command using the following procedure, on the laptop that will run the OS :
- Mount the VHD in the disk managment (diskpart can too) --> on my computer, that add two drives, F: for the reserved system partition, G: for the windows partition
add all drivers of the laptop to the image by typing :
dism /image:g: /add-driver /driver:c:\windows\inf /recurse
Add also the latest downloaded drivers :
dism /image:g: /add-driver /driver:c:\somewhere\drivers /recurse
This took some minutes, but after the operation, my vhd contains all drivers. I think it's important to run the command on the target laptop to ensure all actual hardware's driver is added.
Finally, I rebooted, selected the correct boot entry, and it's boot :)
I had to reboot several times, because of the new hardware detection, but finally my system has been migrated from Virtual to Physical.