8

I created a vhdx file from the c: drive from a lenovo P1G3 a while back and thought I had a working VM from it, but apparently not. Now when I try to boot the VM I get the "The boot loader did not load an operating system". The host is a win10 using the Hyper-V manager, and the VM is set to gen2 with the secure boot disabled. The vhdx file does not look to be corrupt, as I can attach and browse the files without any errors. I've tried the basic windows install iso --> "Startup Repair" but no luck. I've gone around in circles trying to use the bootrec, bcdboot, diskpart, etc... utilities per various superuser and similar forums, but I cannot figure out what is needed, and I'm pretty spun around wondering if I'm even starting in the right place.

enter image description here

Edit: adding more detail about the drive. I only captured the C: volume of the drive, but have 2 unallocated volumes/partitions. Here is what the drive looks like when the vhdx is mounted. updated 2/24: now 7.11GB of free space per multiple shrink commands enter image description here

swv
  • 257
  • You need to configure the boot partition if BIOS, EFI partition if UEFI, and the WinRE partition - Windows does not boot from C: (see section "How do I configure system partitions on a new drive for applying an image?" at the end of this answer) – JW0914 Feb 21 '22 at 21:52
  • I'm still a little fuzzy. the vhdx was captured from a win10 install with EFI/UEFI, I believe. I'm not sure where exactly to start in the answer you linked – swv Feb 23 '22 at 01:16
  • If only C: was captured for the VHD, create two more partitions on the virtual drive (shrink the C: partition) - EFI and WinRE - with the DiskPart commands required being in the last section of the linked-to answer (technically a WinRE partition isn't needed in a virtual environment, but is recommended for convenience of use). If you captured both the C: partition and the EFI boot partition, boot WinPE/WinRE (WinPE is the install ISO) and issue: BootRec /FixMBR && BootRec /RebuildBCD – JW0914 Feb 23 '22 at 14:20
  • Ok, I think i'm following you now. So, I should start under the section in the answer addressing the question "How do I configure system partitions on a new drive for applying an image?"? I should only need to do steps 1 - "Use DiskPart:...", 2 - "Create WinRE partition:..." , and 3 - "Create boot partition:...". Step 4 shouldn't be necessary b/c I already have the system drive? Maybe step 5 if there are still boot issues. Am I on the right track? – swv Feb 24 '22 at 15:37
  • That's correct; you'll need to either shrink the C: partition first or enlarge the VHD by 1GB [1025MB RAW] if creating a WinRE partition, else only 128MB [132MB RAW] for the EFI boot partition. If shrinking, select the C: partition in DiskPart [lis volsel vol #], then shrink desired=1025 minimum=1025 [with WinRE] or shrink desired=132 minimum=132 [EFI partition only]. I can't recall if the C: partition can be shrunk while booted to Windows, so if not, you'll need to boot WinPE (once the Windows installer's GUI loads, press Shift+F10 to open a terminal) – JW0914 Feb 24 '22 at 15:51
  • hmm, ok so it looks like the commands posted in that answer arent valid syntax anymore, getting a "The arguments specified for this command are not valid" for the "Cre Par Pri Offset=1024 Size=665 Id=27" statement. Any chance you know of another answer that might have the same steps? tia – swv Feb 24 '22 at 23:13
  • They work fine - you're using the commands for BIOS, not UEFI. If you get stuck, you can reference the built-in man page via help cre par pri and if you issue help by itself, it'll walk you through the correct help command to issue. – JW0914 Feb 24 '22 at 23:32
  • ok, so i booted vm with the windows install iso, went to command prompt, diskpart, selected the disk, volume, and then tried "shrink desired=132 minimum=132" followed by "Cre Par Pri Offset=1024 Size=665 Id=de94bba4-06d1-4d40-a16a-bfd50179d6ac", but i'm getting a "not enough usable space" error? – swv Feb 25 '22 at 01:47
  • Please use Google and refer to the DiskPart man page – JW0914 Feb 25 '22 at 03:10

1 Answers1

4

You need to set the version to 'Generation 1'. You can do this only if you create the image from 'Hyper-V manager'. So open the Manager, -> New -> Virtual Machine.

In the dialog, the second step is to set the Generation. Try Generation 1, and it should work fine.