Windows 10: How do I restore w10 bootloader? dual boot with ubuntu on separate hdd

Discus and support How do I restore w10 bootloader? dual boot with ubuntu on separate hdd in Windows 10 Installation and Upgrade to solve the problem; The fix windows start-up didn't work, I will try cloning my windows drive tomorrow and go that route as you described. Thanks for your help so far.... Discussion in 'Windows 10 Installation and Upgrade' started by whatitdo6, Dec 27, 2016.

  1. whatitdo6 Win User

    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd


    The fix windows start-up didn't work, I will try cloning my windows drive tomorrow and go that route as you described. Thanks for your help so far. That is a nifty took btw (the iso you linked)
     
    whatitdo6, Dec 28, 2016
    #16
  2. Avocado Win User

    diskpart
    list volume (note the volume letter where the Windows 10 is installed)
    exit

    bcdboot x:\windows (replace "x" with the volume letter of the Windows 10 partition)

    For example, bcdboot c:\windows or bcdboot d:\windows

    If the volume letter is incorrect, you will receive the following error message: Failure when attempting to copy boot files.

    -OR-

    You need to boot from the Windows installation media in UEFI mode (marked UEFI in the boot menu), if Windows is installed in UEFI mode. If you using the wrong mode, you will receive the following error message: Failure when attempting to copy boot files. (see screenshot below)

    diskpart
    list volume (note the volume letter where the Windows 10 is installed)
    exit

    bcdboot x:\windows (replace "x" with the volume letter of the Windows 10 partition)


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]


    EDIT: Look at post #24
     
    Avocado, Dec 28, 2016
    #17
  3. topgundcp Win User
    @whatitdo6
    By default most Linux distros install its Linux Boot Loader (GRUB) and Basically replacing the Boot loader for Windows, so GRUB handles boot loading for both Windows and Linux.The whole EFI System partition was modified, You cannot just create a new BCD and expect it to work, you'd need to rebuild the whole EFI System partition.

    You don't need to re-install Windows. Here's what I suggest you to do:
    • Download my copy of EFI System Partition, use 7-zip to unzip and save it some where , the file name is: EFI_System-00-00.mrimg
      EFI_System.7z - Google Drive
    • Boot up the ISO file downloaded from post #11 and run Macrium, click on restore tab and browse to select the file in step 1 as the source (EFI_System-00-00.mrimg)
    • Select your current Windows SSD as destination disk, (1)click on the 100MB EFI System partition, (2)click "Delete Existing Partition" (3)Drag and drop the "EFI System partition"(3) as shown in the screen shot. Click Finish to restore the new "EFI System Partition"

      How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]
    • IMPORTANT: From top left corner, click on "Fix the Windows Boot Problems"
    • Reboot
     
    topgundcp, Dec 28, 2016
    #18
  4. whatitdo6 Win User

    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd

    @topgundcp I will give that a shot tonight after work. Looks promising. Thank you. Also, what does that "Fix windows boot problems" button in macrium actually do? Does it simply run a bootrec /rebuildBCD ?

    @Avocado That makes sense. My only question is if I delete the efi partition, where does the newly rebuilt BCD come from? Is it from the reserved partition or the windows recover device? Or is the BCD something that is able to be compiled simply with the command prompt and the WinPE ?

    I'm glad you both responded (and @NavyLCDR) when you did, I was about to throw in the towel last night and just wipe the ssd and start over. I'll let you know how this works out tonight after work.
     
    whatitdo6, Dec 28, 2016
    #19
  5. Avocado Win User
    bcdboot <source>

    source - Specifies the location of the Windows directory

    Examples:

    bcdboot c:\windows
    bcdboot d:\windows

    If Windows is installed in UEFI mode and if you boot from the Windows installation media in UEFI mode (marked UEFI in the boot menu), then the "bcdboot <source>" command copies the boot files from the Windows OS partition to the EFI System partition and creates the BCD store in the same partition.


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]
     
    Avocado, Dec 28, 2016
    #20
  6. whatitdo6 Win User
    @Avocado

    It is indeed a EFI install, and the disk is GPT format, I also check secure boot (when I checked this info when I could still boot into win10) and it said "unsupported" so I don't know what to make of that.

    > bcdboot c:\windows

    Your post #6:

    I did this and made it to bcdboot C:\Windows and assumed that the "#Where your Windows drive was" meant to use the volume number of the partition that contains the EFI (the 100MB one) and it failed

    When it failed I tried:

    within diskpart,

    sel vol = 3 (volume assumed to be EFI bc 100MB system)
    assign letter = K:
    exit

    cd /d K:\EFI\Microsoft\Boot\bootrec /fixbootren BCD BCD.old bcdboot C:\Windows /l en-us /s K: /f ALLexit
    (reboot)

    This failed at bcdboot as well. I tried it multiple times and sometimes the: ren BCD BCD.old doesn't work. From what I understand this is backing up the existing BCD as a different name (.old) so that the new BCD can be written.

    After the: bcdboot C:\Windows /l en-us /s K: /f ALL command I get something along the lines of cannot find location.

    For reference, here is the current map of my drives (reposted from my earlier post #12) and an error I received at an earlier point that I no longer receive. in this screen shot I assigned letter V. After each reboot that drive letter is cleared.
     
    whatitdo6, Dec 28, 2016
    #21
  7. topgundcp Win User
    @whatitdo6
    The procedure I gave above will copy my Windows 10 EFI System partition with all the correct files/folders structure and yes, the option "Fix Windows Boot Problems" will automatically rebuild the BCD to point to the correct partition GUID ID of your Windows C drive while others suggest to manually rebuild it.
    This procedure will take few seconds to complete once you boot the ISO downloaded from post #11 and run Macrium.
     
    topgundcp, Dec 28, 2016
    #22
  8. whatitdo6 Win User

    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd

    @topgundcp
    Thanks for clarifying that. Makes sense.

    those partition files that I will download from you; I assume I could access those by placing them on a usb stick on another computer, plugging that into this problem computer, and then access/use them when booted up in that tool from post #11?
     
    whatitdo6, Dec 28, 2016
    #23
  9. topgundcp Win User
    Yes. You can also save it to the same USB that you use to create the bootable ISO. It is a small file ~19MB.
     
    topgundcp, Dec 28, 2016
    #24
  10. whatitdo6 Win User
    @topgundcp

    Thanks, I'll be giving this a shot first thing when I get home. Thank you!
     
    whatitdo6, Dec 28, 2016
    #25
  11. Avocado Win User
    The UEFI firmware supports two boot modes: UEFI mode and Legacy BIOS mode.

    - UEFI mode starts the Windows 10 boot process directly from the EFI system partition of a hard drive. UEFI mode and the GUID Partition Table (GPT) partition style on the hard drive do not use boot sectors and there is no need to set any partition as active. Note that the "bootrec /fixboot" and "bootrec /fixmbr" commands are not needed at all, if the hard drive has a GPT partition style.

    - Legacy BIOS mode starts the Windows 10 boot process at the first sector of a hard drive containing the MBR boot code. Legacy BIOS mode uses the Master Boot Record (MBR) partition style.

    1. How to fix the Windows 10 bootloader if the hard drive has a GUID Partition Table (GPT) partition style.

    On a GPT disk, Windows Setup will create a Recovery partition, an EFI system partition, a Microsoft Reserved partition (won't show in Disk Management) and a primary Windows partition.


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]
    Information The EFI system partition is a FAT32 formatted partition from where the UEFI firmware launches the UEFI bootloader and application. If the EFI system partition has been corrupted, you can use BCDBoot to recreate the EFI system partition boot files by using new copies of these files from the Windows partition.

    bcdboot <source>

    Examples:
    bcdboot c:\windows
    bcdboot d:\windows

    BCDBoot Command-Line Options


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]
    Information How to create an Extensible Firmware Interface (EFI) system partition on a GUID Partition Table (GPT) disk.

    create partition efi [size=<n>] [offset=<n>]

    size=<n> The size of the partition in megabytes (MB). If no size is given, the partition continues until there is no more free space in the current region.

    offset=<n> The offset in kilobytes (KB), at which the partition is created. If no offset is given, the partition is placed in the first disk extent that is large enough to hold it.

    Examples:
    create partition efi
    create partition efi size=100
    create partition efi size=260 (for "Advanced Format 4Kn" drives)

    UEFI/GPT-based hard drive partitions

    Boot from the Windows 10 USB/DVD in UEFI mode (marked UEFI in the boot menu). Press either SHIFT+F10 to bring up the command prompt or at the "Install now" screen click "Repair your computer" > "Troubleshoot" > "Command Prompt".


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]


    Option 1 - Recreate the EFI system partition boot files.

    diskpart
    list volume (note the volume letter where the Windows 10 is installed)
    exit

    bcdboot c:\windows (if "C" is the volume letter of your Windows 10 partition)

    BCDBoot copies the boot files from the Windows 10 partition to the EFI system partition and creates the Boot Configuration Data (BCD) store in the same partition.

    If the volume letter is incorrect or if you boot from the Windows 10 USB/DVD in Legacy BIOS mode (not marked UEFI in the boot menu), you will receive the following error message: Failure when attempting to copy boot files.


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]


    Option 2 - Format the EFI system partition and add boot files to the EFI system partition.

    diskpart
    select disk 0
    list partition
    select partition # (make sure to select the EFI system partition)
    format quick fs=fat32
    exit

    bcdboot c:\windows (if "C" is the volume letter of your Windows 10 partition)


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]


    Option 3 - How to delete and recreate the EFI system partition, if you do not have unallocated space.

    diskpart
    select disk 0
    list partition
    select partition # (make sure to select the EFI system partition)
    delete partition override
    create partition efi
    format quick fs=fat32
    exit

    bcdboot c:\windows (if "C" is the volume letter of your Windows 10 partition)


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]


    Option 4 - How to delete and recreate the EFI system partition, if you have unallocated space.

    Note: If your unallocated space is immediately to the right of the EFI system partition.
    - step 3: list partition (check the current size of your EFI system partition)
    - step 6: create partition efi size=<n> (the size of the partition in megabytes (MB))

    Note: The unit in the offset parameter (offset=<n>) is kilobytes (KB), not megabytes (MB) or gigabytes (GB).
    1 MB = 1024 KB - MB to KB Conversion Megabytes to Kilobytes Calculator
    1 GB = 1048576 KB - GB to KB Conversion Gigabytes to Kilobytes Calculator
    Example: Offset is 451 MB > 451x1024=461824 > create partition efi offset=461824

    diskpart
    select disk 0
    list partition (check the current offset of your EFI system partition)
    select partition # (make sure to select the EFI system partition)
    delete partition override
    create partition efi offset=<n> (you need to use kilobytes (KB) instead of megabytes (MB) or gigabytes (GB))
    format quick fs=fat32
    exit

    bcdboot c:\windows (if "C" is the volume letter of your Windows 10 partition)


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]


    2. How to fix the Windows 10 bootloader if the hard drive has a Master Boot Record (MBR) partition style.

    On an MBR disk, Windows Setup will create a System Reserved partition and a primary Windows partition.

    Boot from the Windows 10 USB/DVD in Legacy BIOS mode (not marked UEFI in the boot menu). Press either SHIFT+F10 to bring up the command prompt or at the "Install now" screen click "Repair your computer" > "Troubleshoot" > "Command Prompt".

    bootrec /fixboot (writes a new boot sector to the system partition)
    bootrec /fixmbr (writes a MBR to the system partition but does not overwrite the existing partition table)

    diskpart
    list volume (note the volume letter where the Windows 10 is installed)
    exit

    bcdboot d:\windows (if "D" is the volume letter of your Windows 10 partition)

    BCDBoot copies the boot files from the Windows 10 partition to the system partition (active partition) on the primary hard drive and creates the Boot Configuration Data (BCD) store in the same partition. If the System Reserved partition exists, it is the system partition, if not, the Windows 10 partition is the system partition.

    If the volume letter is incorrect or if you boot from the Windows 10 USB/DVD in UEFI mode (marked UEFI in the boot menu), you will receive the following error message: Failure when attempting to copy boot files.


    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd [​IMG]


    If the System Reserved partition exists
    - System Reserved partition (System, Active, Primary Partition)
    - Windows OS partition (Boot, Page File, Crash Dump, Primary Partition)

    If the System Reserved partition does not exist
    - Windows OS partition (System, Boot, Page File, Active, Crash Dump, Primary Partition)

    This naming convention is confusing. The "System" partition on a Windows computer is where the files needed to "boot" the computer are located. It is normally the first partition on the first hard drive enumerated by the computer's BIOS. The "Boot" partition of a Windows computer can be located on any other hard drive and contains the files for the Windows operating system.

    Note: If you receive the error message "Element not found" when you run the "bootrec /fixboot" command, then you have to first mark the System Reserved partition as active. If the System Reserved partition does not exist, then mark your Windows 10 partition as active. There can be only one active system partition at a time on the primary hard drive.

    diskpart
    select disk 0
    list partition
    select partition # (if the System Reserved partition does not exist, then select the Windows 10 partition)
    active
    exit

    If you activate the wrong partition, then use the "inactive" command to de-activate it.

    You can check whether the partition is active or not, for example: diskpart > select disk 0 > select partition 1 > detail partition > The output will have: Active: Yes/No.



    How to use BCDBoot to add or repair the boot menu on a dual-boot PC.
    Look at post #3 in this thread: EasyBCD Dual Boot management for Win10 and Win7 on separate drives

    For more info about UEFI mode and Legacy BIOS mode.
    Look at post #5 in this thread: Cant install Windows 10 because of GPT partition error message
     
    Avocado, Dec 28, 2016
    #26
  12. whatitdo6 Win User
    @Avocado

    i understand the difference between booting the recovery disk in UEFI vs legacy. I've been doing it in UEFI. I will try what you outlined here first, simply bc I'd like to be able to know how to do this manually (learning experience).

    But if this doesn't work, I will just use topgun's EFI partition data and do it how he outlined.
     
    whatitdo6, Dec 28, 2016
    #27
  13. whatitdo6 Win User

    How do I restore w10 bootloader? dual boot with ubuntu on separate hdd

    THANK YOU. This solved it. I think this was mentioned earlier by you or someone else perhaps but I've messed around with it enough now where I vaguely understood what the commands were doing. I actually had to delete the partition, recreate it, and re write the BCD as you suggested in Step 3.

    Shoutout to @topgundcp I'm sure that last method you suggested would have worked too, but now I understand how to do it manually, so I learned something.

    Also, thank you @NavyLCDR for your help as well.

    I have ONE last question, any SAFE way to remove the old ubuntu EFI entries that are present in my UEFI as boot options?

    edit: Nvm, figured it out. For anyone else wanting to know how to remove old EFI boot entries, use "EasyUEFI" it is super easy. Took like 10 seconds after install. I DID have two identical looking EFI's for my samsung ssd, one of them, in the details, showed that it had no file path. I assumed that was my old broken one and deleted it, must have been correct bc my computer boots up perfect.

    Thanks!!!
     
    whatitdo6, Apr 4, 2018
    #28
Thema:

How do I restore w10 bootloader? dual boot with ubuntu on separate hdd

Loading...
  1. How do I restore w10 bootloader? dual boot with ubuntu on separate hdd - Similar Threads - restore w10 bootloader

  2. How can I restore the Windows bootloader after reinstalling Ubuntu in a dual-boot setup on...

    in Windows 10 Gaming
    How can I restore the Windows bootloader after reinstalling Ubuntu in a dual-boot setup on...: Encountered issues in a dual-boot configuration with Ubuntu 23.10 and Kali Linux installed on a 512 GB SSD with Ubuntu allocated a larger partition. Windows was on a separate 1 TB SSD, consisting of two partitions - one of 150 GB for the C drive and another of the remaining...
  3. How can I restore the Windows bootloader after reinstalling Ubuntu in a dual-boot setup on...

    in Windows 10 Software and Apps
    How can I restore the Windows bootloader after reinstalling Ubuntu in a dual-boot setup on...: Encountered issues in a dual-boot configuration with Ubuntu 23.10 and Kali Linux installed on a 512 GB SSD with Ubuntu allocated a larger partition. Windows was on a separate 1 TB SSD, consisting of two partitions - one of 150 GB for the C drive and another of the remaining...
  4. Dual-boot PC - w11 or w10 - Restore PC to a Restore Point in w11 or w10

    in Windows 10 Installation and Upgrade
    Dual-boot PC - w11 or w10 - Restore PC to a Restore Point in w11 or w10: Dual-boot PC - w11 or w10 - Restore PC to a Restore Point in w11 or w10 HOW TO CHOOSE e.g. Windows 10 and PROCEED TO SYSTEM RESTORATION without affecting the other Windows 11????...
  5. Dual Boot Ubuntu

    in Windows 10 Installation and Upgrade
    Dual Boot Ubuntu: I am a software developer who has recently got some embedded systems work. The support community for the tools I will be using is built with the assumption of a Linux operating system. While for other types of work-loads, such as backend work, I have been happy with my...
  6. Dual boot Ubuntu

    in Windows 10 Installation and Upgrade
    Dual boot Ubuntu: I tried 'Ubuntu' for a while. Later got the drive deleted. [ATTACH] But the Ubuntu Boot Manager is there in the BIOS ? How can I remove that? Dr Abdul Rasheed https://answers.microsoft.com/en-us/windows/forum/all/dual-boot-ubuntu/8d273b76-c1f2-4f23-9ba6-28a4c96b9141
  7. Dual boot with Ubuntu

    in Windows 10 Ask Insider
    Dual boot with Ubuntu: Hello, I wanted to dual boot with ubuntu on HDD while my windows is on SSD. Most tutorials I have seen usually show the option to select the OS they want to boot into when they start the computer. I was wondering if there is a way where I could always boot into windows...
  8. Dual boot with Ubuntu gone

    in Windows 10 Ask Insider
    Dual boot with Ubuntu gone: Suddenly my grub is gone and when I boot my device goes directly to the Windows 10. Can I remove Ubuntu through Windows without concerns or should I need to be careful because grub is still around and probably will brick my PC? Thanks! submitted by /u/Johan144 [link]...
  9. Restoring windows 10 on a dual boot laptop with ubuntu

    in Windows 10 Backup and Restore
    Restoring windows 10 on a dual boot laptop with ubuntu: I have installed dual boot windows 10 & Ubuntu on my laptop. I accidentally permanently deleted "swapfile.sys" & "pagefile.sys" from my machine while I was logged in from Ubuntu which resulted in loss of my windows 10 account & setting. Because of hundreds of settings...
  10. Ubuntu Dual Boot

    in Windows 10 Installation and Upgrade
    Ubuntu Dual Boot: I am using the non-metro Windows 10 boot loader to manage a dual boot setup (legacy BIOS) with Ubuntu. Generally, everything works fine. However, sometimes when I perform an update in Ubuntu, grub overwrites the Windows MBR. Then I have to use EasyBCD to restore the Windows...