Note to my future self :).
Reloading my Linux install after a pretty radical 'nuke and pave' I had to get my Windows dualboot back to work.
There are a thousand guides on how to do that, but I'll add another one in case your setup is similar to mine.
I have installed windows on a separate drive and Linux on my main drive, along with the efi partition.
Don't follow this guide blindly. Think about every step you take, because you can seriously mess up your system :).
With that out of the way, the things you have to do are:
- Boot a windows install medium.
- Choose your language and enter the 'repair options'.
- Go to advanced and select 'command line'.
- To mount the efi partition type diskpart and in diskpart then type list volume. A list of volumes will be printed and one of them the efi partition (usually around 500mb ). Select this partition (select volume
[number]
) and assign a drive letter (X
is the drive letter you assign). - Check where your windows partition is mounted. The diskpart list volume output will probably include it. I will assume that it is volume
C
. Exit diskart withexit
. - To finally install the boot files type the command
bcdboot c:\windows /s x:
. This will generate boot files based onc:\windows
and install them on the partition with the letterX
.
Thats it, you can reboot now.
You may have to reconfigure grub (or whatever loader you use). On arch-linux, make sure you have os-prober installed :).
Top comments (5)
Thank you, tried this and still worked to recover an EFI partition for Window 11 after formatting the EFI partition in my Debian 11. Thank you for taking the time to write this
Thanks for this buddy, just got a fatal error on a Linux install and eh what to do, it'll be ok, have a fun day! ;D
Big thanks!
LOL, not the clearest set of instruction but it definitely helped me out so thank you! You saved me a lot of work. You neglected to mention that you have to exit out of diskpart with the command 'exit' and then run the bcdboot command. Also, 'bcdboot c:\windows /s x' produced an error for me that said something like "BFSVC: Failed to set element application device. Status = [c00000bb]" and another I'm too lazy to try and find. There should be a colon at the end of 'x', i.e. the efi partition that was assigned a new letter in this tutorial. The command should look like this:
bcdboot c:\windows /s x:
Dude you're life saver!
Thank you so so so much.