sircles.net Computer Support The sircles IT blog | Booting a Gen2 UEFI Disk2VHD VHDX Image in Hyper-V

Twitter Feed Popout byInfofru

The sircles IT blog Internet Safety & Security, Windows Tweaks and Server Fixes

Booting a Gen2 UEFI Disk2VHD VHDX Image in Hyper-V

6. December 2018 10:45 by sircles in Data Recovery, Windows Server, Microsoft Windows
Booting a Gen2 UEFI Disk2VHD VHDX Image in Hyper-V There are lots of great posts on this subject, bu

Booting a Gen2 UEFI Disk2VHD VHDX Image in Hyper-V

There are lots of great posts on this subject, but I just wanted to add my experience as there can often be situations where no matter what you do you cannot get the original VHDX file to boot because it is a GPT file linked to a specific hardware and the secure boot files cannot be replaced.

The important thing to remember is that if you can mount your VHDX file in Windows 10 then there is a very good chance that you can get your system booting once more. Even if you have lost some of your windows files you can now run SFC /scannow in the Windows PE environment.

I very often receive DISK2VHD exported files from other companies that we need to import to our systems for various reasons and whether we use partition software to convert to MBR the result is often that the VHDX simply loses all partitions.

The first step is always to take a copy of your original VHDX files and leave them safely in place.

Once you have your copy you can then test that it can be mounted in Windows 10 - if you can mount the system disk then the image is intact and you can progress:

Once you have mounted the disk you should be able to browse the contents of the Windows drive...

Now you need to get this system partition on an MBR disk.

The easiest and safest way to end up with an MBR version of the system disk is to create a new VHD bigger than the VHDX file you are trying to convert. In my case here I am converting a disk of 55GB in size so I am creating an 80GB VHDX file in Computer Management to copy it to.

I create my new disk as an MBR disk and format as an NTFS volume.

 

 

Now I copy all of the system folder of my GPT VHDX (which I mounted on my Windows 10 box earlier) to the newly created MBR disk:

Using the Xcopy command in a prompt running as administrator, I will add the following switches:

  • /s: copy directories and subdirectories, unless they are empty. If you omit “/s”, xcopy will work within a single directory.

  • /e: copy all subdirectories, even if they are empty.

  • /h: copy files with hidden and system file attributes.

  • /i: if in doubt always assume the destination is a folder.

  • /c: continue copying even if an error occurs.

  • /y: suppress prompt to confirm overwriting a file.

So XCopy olddrive: newdrive: /s /e /h /i /c /y

Now I have a file-level copy of the GPT disk on an MBR disk.

I detach both drives from my Windows 10 machine.

Now I replace the GPT VHDX boot file in my server VM with the newly created VHDX file we have just copied the files into.

Now I run the VM with a Windows 10 DVD ISO attached as we will need to recreate the boot files.

Because we are using a Windows 10 DVD I can simply choose 'Start-up Repair' rather than use the command line which will create the Boot directory and add the system to the boot record.

Now we can boot the image without any issues of hardware, secure boot or other difficulty.

If you are getting as BSOD at this point then do try SFC /scannow whilst in the Windows PE environment to repair the installation.

Typically it will take a while to pass the 'Getting devices ready' stage whilst booting as a VM for the first time.

 

Add comment