Windows – Cannot make VHD bootable

bootbootloadervhdvirtualizationwindows 10

I cannot make my VHD bootable.

I'm following this guild word for word, trying to create a Bootable VHD.

The BCDboot is supposed to create boot configuration entry so that windows bootloader can boot from the VHD, and I've seen it went successful, however, it just doesn't work:

D:>P:\windows\system32\bcdboot P:\windows /s P:
Boot files successfully created.

D:>BCDEdit

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\MICROSOFT\BOOT\BOOTMGFW.EFI
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {c605aeaf-...8}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
-------------------
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.efi
description             Windows 10
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {c605aeb1-...8}
displaymessageoverride  Recovery
recoveryenabled         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \Windows
resumeobject            {c605aeaf-...8}
nx                      OptIn
bootmenupolicy          Standard
hypervisorlaunchtype    Auto

I.e., the device partition=P: entry is not there.
When I tried to boot it from Hyper-V, Hyper-V tells me that there is no boot-loader.

What could possibly wrong and how can I fix it? (again, I'm followed this guild word for word successfully until I came to the bcdboot & BCDEdit step. I.e., all my steps are exactly as shown there.)

UPDATE:

I'm not sure if I'm using UEFI though, because these are all it takes for me to create my disk:

select vdisk file=e:\vhd\winboot.vhd
attach vdisk
create partition primary
assign letter=v
active
format quick FS=NTFS Label=VHD

Most importanly, when select the Generation type for hyper-v, I chose Generation 1, which I think don't support UEFI.

Best Answer

If you are using UEFI, you need to convert the attached VHD's partition table to GPT:

  1. Access WinPE ? Open Command Prompt
  2. Prepare the UEFI disk by creating three partitions via diskpart:
    diskpart
     select disk 0
     clean
     convert gpt
    
     rem == 1. System partition =========================
     create partition efi size=100
     format quick fs=fat32 label="System"
     assign letter="S"
    
     rem == 2. Microsoft Reserved (MSR) partition =======
     create partition msr size=128
    
     rem == 3. Main partition ===========================
     create partition primary
     format quick fs=ntfs label="Main"
     assign letter="M"
    
     exit
    
  3. Add the entry in the boot menu with /f UEFI
Related Question