I have a PC that can boot both Ubuntu and Win10, with Win10 pre-installed. While experimenting with bootable USB drives, I mistakenly formatted the Win boot partition on /dev/sda1, which is 524MB in size, causing me to lose access to my Windows system. Grub no longer lists it. Luckily, my user data and recovery partition are still intact. My goal now is to recreate the boot partition so that I can boot into Windows again without affecting the user-data partition.
I have already tried to repair the boot sector using a bootable Win10 USB drive and following a guide, but neither the automated option nor the command prompt option worked. I also attempted to use AOMEI, but encountered a “load driver failed” error message when trying to install it using Wine. Additionally, when trying to execute the “bootrec /fixboot” command prompt option mentioned in the guide, I received a “permission denied” message. I haven’t yet tried copying a boot sector from another working Win10 setup because I don’t have access to one.
Can someone please provide instructions on how to restore the boot sector safely?
3 Answers
I partially solved the problem by performing the command “bcdboot E:\Windows /s C:” in Windows recovery cmd, where E: represents the User-Partition and C: represents the boot partition. Then, I used rescatux (a Linux OS with grub) to run “update-grub” based on instructions from https://askubuntu.com/questions/145241, which made Windows reappear in the grub menu.
Special thanks to Karel for providing support and helping me understand some basics. Although I can’t recall all the steps I took to make it work, I think I reformatted the boot partition to Fat32, ran bootrec commands (fixmbr, fixboot, and rebuildbcd), and used the bcdboot command with an additional /f UEFI option.
Finally, I reinstalled and updated grub on the sda partition to make my Windows system bootable again.
Although it was a challenging bottleneck, I’m pleased that it eventually worked out.