How I recovered Windows Using BCDBoot After an Ubuntu Installation

Last update: 04-27-2024

If you've ever ventured into the world of dual-booting operating systems, you know that sometimes things don't go as planned. Recently, I encountered a challenging situation where I almost lost access to my Windows installations after trying out Ubuntu 24.04. In this blog post, I'll walk you through how I used bcdboot to recover my Windows installations, highlighting the importance of understanding Windows recovery and managing the ESP (EFI System Partition).

The Adventure Begins: Attempting Ubuntu Installation

My setup included two separate Windows instances, each on its own disk, allowing me to choose between them at boot. Eager to try the new Ubuntu 24.04, I installed it over one of the Windows instances. However, post-installation, Ubuntu took over the boot process, and I couldn't access either of my Windows systems.

Discovering the Problem: ESP Partition Complications

I soon realized the root of the problem. My system had only one ESP partition, shared by both Windows installations. By installing Ubuntu, I had inadvertently wiped out this critical partition which was located on the same disk I chose for Ubuntu.

The Recovery Process: Reinstalling and Recovering Windows

After ensuring that my data was safe (accessible through Ubuntu), I decided to wipe the Ubuntu disk and reinstall Windows on it. I deleted all the partitions from the Ubuntu disk and used a Windows ISO file to install a fresh copy of Windows on this disk. This allowed me to access the fresh copy of Windows, but I still couldn't access the other copy, the one I actually needed to regain access to.

Here is what I did from the fresh copy to recover my original Windows installation:

  1. Assigning Drive Letters:
    • In the new Windows installation, I used the Disk Management tool to assign a new drive letter (Q) to the partition of my old Windows installation.
  2. Handling the ESP Partition:
    • Unfortunately, I couldn't change the ESP partition's drive letter through Disk Management as the option was greyed out. I resolved this by using the Command Prompt with admin rights:
      diskpart
      list disk
      sel disk X  (where X is the disk number with the ESP)
      list vol
      sel vol Y  (where Y is the volume number for the ESP)
      assign letter=Z
      exit
  3. Using BCDBoot to Add Windows to the ESP:
    • With the ESP partition now accessible via drive letter Z, I executed the following command to add my old Windows installation back to the boot menu:
      bcdboot Q:windows /s Z: /f UEFI

Success: Dual Boot Restored

After completing these steps and restarting my computer, I was greeted with the familiar boot menu, allowing me to choose between the two Windows instances once again.

Key Takeaways

0 Comments

Add a new comment: