Go to ...

RSS Feed

September 23, 2020

Native boot VHD with GPT virtual hard disk – How to upgrade


If you ask me , a native boot VHD is the most practical method to install additional Windows OS for dual boot, alongside a physical primary OS. Create a VHD file, deploy Windows to it, add it to the boot menu, done! When that OS is no longer needed, delete the VHD and remove its boot entry. No partitioning required.

There’s only one problem: Windows cannot be upgraded when it’s booted to a VHD. Updating is OK, but when the user tries to upgrade Windows, this error message appears: “You can’t upgrade Windows on a virtual drive” (see title image). To upgrade Windows on a native boot VHD, it must be attached to a virtual machine. After an upgrade, that virtual machine can be safely deleted, and the user can now boot to whichever VHD contains the newly-upgraded version of Windows.

Regardless if the host PC is a UEFI / GPT or BIOS / MBR system, a native boot VHD can be either an MBR or a GPT disk. In the case of an MBR virtual hard disk, adding it to a virtual machine for upgrade is piece of cake. An MBR VHD does not need any system partitions, it can be a single partition VHD only containing a Windows partition. I’ve written a tutorial on Ten Forums about how to upgrade this thing: Native boot Virtual Hard Disk – How to upgrade Windows

However, a GPT VHD cannot be used on a virtual machine if it does not have the correct GPT partition structure. If you need a GPT disk on your native boot VHD, it must be partitioned according to the GPT partitioning guidelines. My PowerShell script does this automatically: Native Boot VHD – One-Click Deployment. Other options are to use DISKPART to manually create partitions correctly, or to install Windows on a new Hyper-V Generation 2 virtual machine, then use its VHD for native boot.

OK, if GPT partitioning is done correctly, you can attach the VHD to a new or existing Generation 2 VM. A native boot VHD does not need boot records — the host takes care of that. But, a VM with a native boot VHD attached to it cannot boot without boot records, so they must be created first. The first step is to boot a VM from any Windows 10 ISO, and in the region selection screen, press SHIFT + F10 to open a Command Prompt window.

At the Command Prompt, start DISKPART (#1 in screenshot). Check the volumes with LIST VOL (#2), and note the drive letter for the Windows partition. If the Windows partition on the VHD has no drive letter, as in my screenshot, select that Windows partition using its volume ID with SEL VOL # (#3), and enter command ASSIGN (#4) to assign the first free drive letter to it, and check which drive letter was taken with LIST VOL. (#5).

Click screenshots to open enlarged in new tab.

Quit from the DISKPART utility using command EXIT (#6). Enter the following command to add boot records to the VHD (#7), changing drive letter C: to whichever letter was / is assigned to Windows partition:

bcdboot C:\Windows /m {d58d10c6-df53-11dc-878f-00064f4f4e08}

That’s it. Close the Command Prompt and restart the VM. It now contains EFI boot records, and will boot normally:

Kari

Author: Kari Finn

A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

Leave a Reply

More Stories From Dual Boot