Wednesday, May 27, 2020

Restoring UEFI OS to a second HDD and dual booting


The starting configuration is a UEFI booting OS on say, disk 0.  The requirement is to restore a backedup UEFI OS on a separate HDD/SSD say disk 1 and enable dual booting.

Restore the backup to disk 1.

You've gone into Advanced Start up of the OS on disk 0 (Troubleshoot_Advanced Options_Command Prompt) and used bootrec /scanos to locate the restored OS on disk 1.  You've tried bootrec /rebuildbcd to add the newly restored OS to the boot configuration database (BCD).

bootrec /rebuildbcd  locates the OS on disk 1 and offers to sort it out.

Successfully scanned Windows installations.
Total identified windows installations: 1
[1]   D:\Windows
Add installation to boot list? Yes(Y)/No(No)/All(A):

You select Y thinking your task is nearly complete but instead of success you get

The system cannot find the path specified.

Exit and reboot normally back into the OS on disk 0.

Instead, you will need to manually add the entry to the BCD using bcdedit in an elevated command window.

Run CMD.EXE as admin and enter bcdedit to see the existing entries.  You probably have a Windows Boot Manager and Windows Boot Loader section which controls booting into the OS on disk 0. 

You need to add another Windows Boot Loader entry for the restored OS on disk 1.

The existing entry in the list is referred to as {current}

Make a copy of it using this command.  This using the /d switch to label the entry for it's appearance on the dual boot screen.  Below I have used Windows 8.1

bcdedit /copy {current} /d "Windows 8.1"

Now run bcdedit again to see the result.  You have a another Windows Boot Loader entry with a description of Windows 8.1.  Notice that an arbitary GUID identifier has automatically been generated and applied to it.  You need to copy the GUID into the commands below to identify the Windows Boot Loader entry you are modifying

Now customise it for the OS on disk 1

Bcdedit /set {copiedGUID} device partition=d:
Bcdedit /set {copiedGUID} osdevice partition=d:

Finally modify the Windows Boot Manager settings so that the dual boot selection screen appears when the computer is booted.

Bcdedit /set {bootmgr} Displaybootmenu yes

Bcdedit /set {bootmgr} timeout 20

Run bcdedit again to review how the settings have been updated.

Now reboot and select the restored OS in the list to boot into the restored OS on disk 1.