I had a working dual-boot system and decided to introduce an M.2 drive. I migrated my gentoo install to the drive and grew my windows partiton to eat up all the former linux. Gentoo boots normally, but to boot windows I have to remove the M.2 drive. With the M.2 drive in the BIOS finds the windows boot loader, but it does not load up the OS.

What do I need to do to tell Windows to use the second drive in the system?

0 blaze:0.0 /root # lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT
|-sda1  swap                       [SWAP]
`-sda2  ext4                       /

|-sdb1  ntfs              Recovery 
|-sdb2  vfat                       /boot/efi
`-sdb4  ntfs  

`-sdc1  linux_raid_member blaze:0  
  `-md0 ext4                       /home
sdd     linux_raid_member          
`-sdd1  linux_raid_member blaze:0  
  `-md0 ext4                       /home
`-sde1  linux_raid_member blaze:0  
  `-md0 ext4                       /home

sda is the M.2 and sdb is a solid state drive.

  • Did my answer help you out?
    – DGoiko
    May 13, 2019 at 19:12

2 Answers 2


This is the reason I preffer using grub to handle multiboot systems. Anyway, here's how to fix a Windows 10 boot partition:

ORIGINAL SOURCE: Use Diskpart to Fix UEFI Boot Error in Windows 10/8/7 This is not my solution. This is copied from a commercial website which sells partition tools. I have nothing do to with them. I strongly advise you to backup your hard drive: It's been a long since last time I did this in Windows, and though the commands looks good, they may have messed something up.

Method 1. Use Diskpart to Fix UEFI Boot Error in Windows 10/8/7

Probably you only have to do "Step 1: Type below command and hit Enter each time:" "3 - Repair the Boot Record" and "4 - Rebuild the BDC Store" If you are a Windows 10 or 8 user and you prefer free methods to fix UEFI boot error, you may follow below two solutions to solve this issue now: 1 - Enter Command Prompt from Advanced options

Step 1: Insert Windows 10/8/7 installation disk or installation USB into PC > Boot from the disk or USB.

Step 2: Click Repair your computer or hit F8 at the Install now screen.

Step 3: Click Troubleshoot > Advanced options > Command Prompt. 2 - Run Diskpart to set partition ID and assign drive letter

Step 1: Type below command and hit Enter each time:

list disk
sel disk 0

Run Disk Part to start fixing UEFI error. Be carefull! it may not be disk 1

Step 2: When the message "Disk 0 is now the selected disk" shows up, type: list vol and hit Enter.

Select disk and volume to set volume ID.

Diskpart will now show the full list of volumes on your PC, find UEFI volume from the list: UEFI partition will be on Volume 2.

Step 3: Do this only if your disk doesnt have ID: Type below command and hit Enter each time:

sel vol 2
set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b 
Or SET ID=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7

Set volume ID to fix volume id.

Step 4: Do this only if your boot disk doesnt have a letter: Assign drive letter by typing below command and click Enter:

assign letter=G: 

Change drive letter of your selected partition.

(Note: G shall be a unique drive letter which cannot be already used.)

3 - Repair the Boot Record

Step 1: Open Command Prompt as administrator, enter below command:

cd /d G:\EFI\Microsoft\Boot\

Note: G is the drive letter you signed to UEFI partition and remember to replace G with UEFI's partition letter.

Repair boot record on UEFI disk.

Enter: exit when the process completes.

Step 2: To repair the Boot Record, open CMD and enter below command line:

bootrec /fixboot

Fix boot record command.

Enter: exit when the repair process completes.

4 - Rebuild the BDC Store

Step 1: Type each command line and hit Enter each time:

ren BCD BCD.old
bcdboot C:\Windows /l en-us /s G: /f ALL (Note: c:\ is the drive where Windows 10/8.1/8 is installed on.)

Rebuild BDC store on UEFI.

Step 2: Type: exit in Command Prompt when the process completes and then restart your PC.

Now UEFI boot is fixed and Windows 10/8/7 can be boot up on your PC again.

Method 2. Use Automatic Repair to repair Windows 10/8/7 UEFI

Windows Automatic Repair is a built-in tool for users to apply and try to fix some normal errors on Windows PC. And you may also try this method to repair Windows 10, 8 or 7 UEFI/EFI boot error:

1- Boot up Windows from Installation media

Step 1: Insert Windows 10/8/7 installation disk or USB to your PC.

Step 2: Restart PC and boot from the disk or USB.

2 - Enable Automatic Repair option

Step 1: Click Repair your computer at the Install now screen.

Enable Automatic repair option to fix UEFI error.

Step 2: Click Troubleshoot at Choose an option screen > Click Automatic Repair.

Use Automatic Repair option to fix UEFI boot error.

Step 3: Choose an account from the list to continue at the Automatic Repair screen and wait for the process to finish.

When the process completes, you can restart your PC and then you should be able to use your computer without any problems again.

  • EFI partition can be mounted with mountvol X: /s command as admin.
    – Biswapriyo
    May 12, 2019 at 18:12

What you think is the BIOS is really the UEFI boot. As you have changed the disk numbers, Windows is now on sdb which used to be sda. I don't know how you have migrated your disk, but there is a possibility that the Windows installation that is displayed during the boot is a phantom installation that no longer exists on the new sda.

This procedure will help to detect the right Windows installation:

  1. Boot Ubuntu and mount your Windows partition (as by opening the disk on Nautilus)

  2. Run the following command:

    sudo os-prober
  3. If your Windows installation was found, you can run:

    sudo update-grub

Note that step 2 is only for knowing beforehand if the probe will succeed. You could also skip this step and just mount the Windows partition and directly run sudo update-grub.


  • I'm running gentoo and booting directly with uefi. Don't have os-prober or update-grub. What do those things do? May 4, 2019 at 4:29
  • And you're right that the windows install does not exist on the new sda - I did not change the boot or recovery partition, just grew the windows parition over my old gentoo partition. May 4, 2019 at 4:31
  • The optional os-prober utility is provided through the sys-boot/os-prober package. I don't use Gentoo, but you might need to run emerge os-prober followed by grub-mkconfig -o /boot/grub/grub.cfg. If you are using Grub, I don't know how update-grub can be missing, maybe see this post for refreshing Grub.
    – harrymc
    May 4, 2019 at 6:29
  • I'll have a look at os-prober. I'm not using grub because the kernel loads right from UEFI. efibootmgr manipulates those parameters. May 6, 2019 at 21:31
  • os-prober looks like it is tied to grub, which I don't need. It does find my Windows install, but looks like it can't tell Windows to use the second drive to load the kernel. May 6, 2019 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.