Can't boot to a vhd exported from hyper-v

3

5

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.

Steve B

Posted 2012-01-04T14:22:12.370

Reputation: 1 580

What OS is your laptop running? (64-bit?) – TheCompWiz – 2012-01-04T14:48:06.977

Windows 7 x64 Enterprise Service Pack 1 + all updates – Steve B – 2012-01-04T14:52:51.837

Prior to making the .vhd ... did you install the integration tools? – TheCompWiz – 2012-01-04T14:55:09.457

there is no integration tools for W2K8 R2. Everything is in the OS directly. – Steve B – 2012-01-04T14:59:37.707

Honestly, if we could get the BSOD info... we could probably get a better picture as to why it's misbehaving... Usually there's some sort of "STOP" message... with several bits of info... or whatever that can give some insight to what went wrong. If you're not getting a stop message... what is the EXACT message you're getting? – TheCompWiz – 2012-01-04T15:03:14.780

Have you tried safe-mode? – TheCompWiz – 2012-01-04T15:03:39.943

STOP: 0x0000007B, which means inaccessible boot device. – Steve B – 2012-01-04T15:10:28.563

7B = inaccessable boot device. usually this means that the disk drivers aren't installed... What disk emulation mode did you use on the Hyper-V server and on your laptop? (SCSI/IDE/???) – TheCompWiz – 2012-01-04T15:12:47.370

the default choice, IDE – Steve B – 2012-01-04T15:13:46.013

On both? (laptop/server) – TheCompWiz – 2012-01-04T15:15:03.987

@TheCompWiz: not sure to understand... the laptop won't run hyper-v, but will boot to the vhd – Steve B – 2012-01-04T15:15:50.207

Are you using windows 7's built-in "Windows Virtual PC"? or what are you using to start the virtual instance? – TheCompWiz – 2012-01-04T15:17:37.717

I don't virtualise the OS. Just the file system. I boot directly to the vhd – Steve B – 2012-01-04T15:19:54.647

You can't boot from the BIOS directly into a FILE on the local hard drive. The BIOS knows nothing about what a "VHD" is. So, at some point you boot into an OS, and run some flavor of virtual machine. Or are you trying to boot from a VHD written to a physical disk? – TheCompWiz – 2012-01-04T15:22:16.360

1

you can : http://technet.microsoft.com/en-us/windows/dd758779. It's a great new feature of W7

– Steve B – 2012-01-04T15:23:35.530

First time I've seen that... kinda interesting. That being said... Install the disk-controller drivers that are used on your laptop... which probably aren't part of the default driver-base for windows 2008r2. – TheCompWiz – 2012-01-04T15:30:31.213

I don't know how to that on an already installed system – Steve B – 2012-01-04T15:33:08.370

On the 2008r2 box (server) ... get the drivers from the manufacturer... right click the .inf and click install. That should be all that is required. – TheCompWiz – 2012-01-04T15:52:15.417

Answers

1

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 :

  1. 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
  2. add all drivers of the laptop to the image by typing :

    dism /image:g: /add-driver /driver:c:\windows\inf /recurse

  3. 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.

Steve B

Posted 2012-01-04T14:22:12.370

Reputation: 1 580

Excellent. @Steve B - this sounds extremely similar to what I'm trying to do. Would it be possible to "Boot to VHD" to the Hyper-V based VM here: 2010 Information Worker Demonstration and Evaluation Virtual Machine (SP1) http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=27417

– tbone – 2012-10-25T20:13:41.047

@tbone: the microsoft IW demo is split in 3 virtual machine. You will probably be able to make the boot works, but you won't be able to log into the machine, as the domain controller won't be accessible. – Steve B – 2012-10-26T04:53:32.123

Ok, I've now run into this very problem. Where you say: "3. Add also the latest downloaded drivers", is that a folder where I would have to have (separately) download ALL the drivers for my laptop? I hope not cuz that will take forever.....but if so, let me know. In the meantime I'm going to try step 1 and 2. – tbone – 2012-10-29T00:18:45.673

EDIT: Ok, performed #2, errors on lots of drivers (ie: boot-critical driver but not properly signed)....rebooted, and got the same stop error. I wonder if I should try to find JUST the eSata drivers (wherever those may be) and "dism" only those to see if the error occurs. – tbone – 2012-10-29T00:35:31.987

Ok, set eSata AHCI mode to Compatible, boot in safe mode, get to a Server 2008 logon screen, CTRL+ALT+DELETE gets me to login prompt, everything looks ok....then, it reboots. No blue screen or anything. Never seen this before. Sigh. – tbone – 2012-10-29T00:49:07.447

@tbone: a lot of reboots may be required, in order to help the system to install the drivers – Steve B – 2012-10-29T16:31:59.990

I tried several....would that tend to be post-logon, new hardware being discovered and installing drivers? The reboot I'm getting after it gets to the logon is just very bizarre. Perhaps there is something that gets written to the log file that I should be checking....I was going to try your step 3, but the Lenovo support site was down most of today. – tbone – 2012-10-29T23:36:35.280

maybe you can try to boot using safe mode – Steve B – 2012-10-30T08:26:02.280

Ya I've tried that. Safe mode, boot without enforcing driver signing, etc. The crash is just weird, no blue screen or anything to give an indication of what the problem is. – tbone – 2012-10-30T17:13:59.777