I installed Ubuntu on a system that has Windows 10 installed. I can boot to Windows or Ubuntu normally using GRUB. I want to delete Ubuntu partition, but first I must restore the Windows 10 MBR.
In Use Bootrec.exe in the Windows RE to troubleshoot startup issues (applies to Windows 7 and Windows Vista) they say to use Bootrec.exe with options /FixMbr /FixBoot, but when I type "bootrec.exe /FixMbr" in a command prompt, Windows says:
'bootrec.exe' is not recognized as an internal or external command.
I say I can boot to Windows 10 and run a command prompt from there (I don't need to use an installation medium), but I don't know what to enter.
-
A quick fix is to boot into the installation media anyway to run bootrec. (Perhaps someone else knows of a solution that doesn't require that.)Maximillian Laumeister– Maximillian Laumeister2015年08月02日 04:10:45 +00:00Commented Aug 2, 2015 at 4:10
-
I have 5mbs, so I'll take me ~3 hours to create Win10 usb boot, I thought I could fix MBR from Windows, like EasyBCD utilty does (not working yet for Win10)Codyfly– Codyfly2015年08月02日 04:28:26 +00:00Commented Aug 2, 2015 at 4:28
-
It might be helpful to edit your question (and its title) to specify that you're looking for a solution that doesn't involve the installation media. I just gave you an upvote, because I'm also curious if it can be done.Maximillian Laumeister– Maximillian Laumeister2015年08月02日 04:35:22 +00:00Commented Aug 2, 2015 at 4:35
-
I finished downloading Win10 and fixed installation via command prompt on recovery diskCodyfly– Codyfly2015年08月02日 06:02:38 +00:00Commented Aug 2, 2015 at 6:02
-
Glad to hear it, and apologies I couldn't help you do it without the install disk.Maximillian Laumeister– Maximillian Laumeister2015年08月02日 06:03:51 +00:00Commented Aug 2, 2015 at 6:03
4 Answers 4
The command in Windows 8/8.1/10 for fixing MBR is "bootsect.exe".
bootsect /nt60 drive_letter: /mbr
this fixes boot record of partition mapped to "drive_letter:" and the MBR of the disk where the partition is placed.
C:\Windows\system32>bootsect
bootsect {/help|/nt60|/nt52} {SYS|ALL|<DriveLetter>:} [/force] [/mbr]
Boot sector restoration tool
Bootsect.exe updates the master boot code for hard disk partitions in order to
switch between BOOTMGR and NTLDR. You can use this tool to restore the boot
sector on your computer.
Run "bootsect /help" for detailed usage instructions.
Alternatively you can use "Dual-boot Repair Tool" which has a graphical interface to bcdboot.exe, bootsect.exe and other useful functions like boot sector view and ... one click dual-boot repair function for Windows 10/8/7/Vista (also can fix Windows XP boot files).
-
4THIS!!...thankyou. Nothing seemed to work on my asus ROG with default windows 10 after i dual booted it with ubuntu and tried to remove ubuntu. I simply logged in to windows and used visiual dualbootrepair. i had tried easybcd and live ubuntu usb bootrepair ( as i dint have win 10 cds)....none of that worked....this worked...an entire day but your answer saved me..thanks!!!yUdoDis– yUdoDis2016年05月28日 12:25:05 +00:00Commented May 28, 2016 at 12:25
-
Thanks @snayob - this is exactly what the boot repair option on the recovery disk should dorvalue– rvalue2016年06月11日 02:59:38 +00:00Commented Jun 11, 2016 at 2:59
-
1Dual-boot repair tool made it really easyFrank Fu– Frank Fu2018年08月06日 12:17:33 +00:00Commented Aug 6, 2018 at 12:17
-
The hint towards
bcdbootwas immensely helpful. Thank you! During a disk crash, my EFI system partition got destroyed. I recreated the files necessary to start my Linux system, but was not able to recover the Windows installation. Usingbcdbootto copy the Windows boot files into it fixed it.devurandom– devurandom2019年05月04日 19:08:51 +00:00Commented May 4, 2019 at 19:08 -
What drive letter should I use?ed22– ed222020年09月26日 01:26:57 +00:00Commented Sep 26, 2020 at 1:26
The other answers given here work great on MBR/BIOS systems, however if you're on a UEFI system like I am, bootsect will just write a semi-functional boot MBR over the GPT protective MBR and bootrec just gives an "Access denied" error message, and neither one has a functional option to fix a broken EFI system partition, which on a UEFI/GPT drive is what contains the bootloader that used to be stored in the MBR. There's unfortunately almost no up-to-date guides on fixing the UEFI Windows Boot Manager (almost all of them just say to run the graphical Startup Repair utility, but that doesn't fix the problem in all cases), but I finally found the correct solution buried in this article, which requires the use of the bcdboot command instead:
Grab the Media Creation Tool, make yourself a Windows 10 installation DVD or USB drive, and then boot into it.
When prompted, choose "Repair your computer", followed by "Troubleshoot", "Advanced Options", and finally "Command Prompt".
Run
diskpartand thenlist disk. Note the disk number for the disk with your EFI system partition (ESP).Select that disk with
select disk x(wherexis the disk number from the last step).Run
list volume. Note the volume number for your EFI system partition (ESP).Now do
select volume x(wherexis the volume number for the ESP) and thenassign letter=N:to mount the partition. Runlist volumeagain and note that the ESP is now assigned a driver letter. Runexitto leavediskpart.(Optional) If you are not currently dual booting and want to fully clean the ESP before writing a new bootloader, run
format N: /FS:FAT32to reformat it as FAT32. This is probably not necessary under normal circumstances, however, asbcdbootseems to do a good job of cleaning things up itself. Especially do not do this if you have a Linux distro on another partition or else you'll have to reinstall GRUB as well once you're done with this. Also note that the following steps should not affect an EFI GRUB install as long as you do not otherwise delete GRUB's existing directory on the ESP.Finally, write the new bootloader to the partition with
bcdboot C:\windows /s N: /f UEFI. This command rebuilds a new UEFI-compatible bootloader on the ESP mounted at N: using the Windows installation mounted at C:\windows. Once it's done, you can verify the new bootloader was written by runningdir N:\EFI, where you should see aMicrosoftdirectory containing the new Windows Boot Manager as well as abootdirectory containing the fallback bootloader (along with other directories for any other bootloaders you have installed, such as GRUB for Linux).(Optional) If you are dual booting, you will probably need to boot into your Linux distro and run
sudo update-grubto allow the GRUB scripts to detect and add the new Windows bootloader.Now boot into your BIOS setup and make sure "Windows Boot Manager" (or GRUB, if you're dual-booting) is set as the top boot choice. Save and reboot and you'll finally be back in Windows (or GRUB).
I was having the following issue:
I had Ubuntu and Windows 10 and deleted Ubuntu partitions using Windows 10. After a restart I got the Partition not found error and automatically entered GRUB.
Here's how I solved it:
- I burned a Windows 10 CD, entered troubleshooting, and from there I entered Windows Console.
- Then I typed in:
bootsect /nt60 drive_letter: /mbr(replace drive_letter with your letter. for example, for me it wasC: /mbr). - And it finally worked.
I hope this also clarifies the solution for people with the same problem as me.
-
2This doesn't work for me. It still continues to boot to GRUB. I've also tried the GUI tool. Any suggestions?Jack– Jack2016年05月22日 17:31:03 +00:00Commented May 22, 2016 at 17:31
-
1how do you just "burn a windows 10 cd"?Thufir– Thufir2016年12月12日 11:26:07 +00:00Commented Dec 12, 2016 at 11:26
-
2@Thufir: create a windows 10 system repair discSteve– Steve2016年12月15日 05:29:33 +00:00Commented Dec 15, 2016 at 5:29
-
1Thanks ! I had to add
/forceand it worked. It should be noted that it's better to check before what is the assigned letter of the partition ; mine was renamed to E: in the Windows Console.Michaël Polla– Michaël Polla2017年10月15日 18:30:15 +00:00Commented Oct 15, 2017 at 18:30 -
This is the exact command that worked for me
bootsect /nt60 C: /force /mbrMoses Machua– Moses Machua2019年08月07日 21:30:54 +00:00Commented Aug 7, 2019 at 21:30
In a very similar case (moved and enlarged partitions, so Windows system/C: partition has been moved – which GParted explicitly warns about), I also had a non-bootable Windows with grub.
Symptom: Had a Windows 10 blue error screen directly after choosing Windows 10 in the grub boot menu with some cryptic error code, which shows not much information. It says I should press F8 for troubleshooting or Enter to retry, but F8 just shows the same error.
Notes: The problem other solutions tries have when you have a working grub you may not want to break that. As such, e.g. do not overwrite the MBR (breaks MBR and requires grub reinstall then) or overwrite the boot sector.
Also, automatically fixing via Windows 10 boot troubleshooting tool did not work.
Solution: Boot a Windows 10 installation media (GParted explains how to get it, direct link for Windows 10) and rebuild the Boot Configuration Data (BCD) store using the cmd.exe/command line Windows 10 from thinstallation media:
bootrec /rebuildbcd
IMHO the Microsoft doc linked from GParted is too cumbersome, and I suggest to refer to these detailed instructions by Ventoy.
This was the only command needed.
PS: In my case I installed the Windows 10 installation media via ventoy to have other rescue ISOs next to it, which worked well.
You must log in to answer this question.
Explore related questions
See similar questions with these tags.