My laptop is (maybe was) Linux and Windows 10 dual booted. I was reinstalling
the Linux OS and in the process I accidentally formatted the Windows 10 boot
partition. At least I think it is the boot partition because I don't really
know how Windows works (or doesn't work amirite).
This is the lsblk output:
$ lsblk -f
NAME FSTYPE FSVER LABEL [...] MOUNTPOINTS
nvme1n1 zfs_member 5000 zroot [...]
├─nvme1n1p1 vfat FAT32 [...] /boot/efi
├─nvme1n1p2 swap 1 [...] [SWAP]
└─nvme1n1p3 zfs_member 5000 zroot [...]
nvme0n1
├─nvme0n1p1
└─nvme0n1p2 ntfs
The nvme0n1p1
is the one related to booting. I accidentally formatted it.
I have a Windows 10 USB prepared. I tried looking online and I never found
a question asking exactly for this. The ones I found that were similar enough
suggested different commands.
Anyone has experience with this?
Thanks in advance.
I assume that's your efi partition where grub lives. If not, you should install grub there as it's gonna be your boot menu, from where you boot any OS. If so, you can download a windows iso and extract the boot files by mounting it on a folder and looking at the boot/ folder. Then you can make a Microsoft/boot/ folder in you efi partition and place the files there. You can check that it works by trying to boot from the grub CLI. Lastly, to make a menu entry for Windows on grub you need to use the 40.custom file on the /etc/grub.d folder iirc and add a menuentry with all the commands you needed for booting Windows.
You should check that you actually replaced the entire boot partition by navigating /boot/efi and looking for extra files that are unused, if not you can skip downloading and extracting the boot files.
I know this is a bit cryptic but I don't have much time rn, I'll edit this comment later
The current boot partition being used for linux is nvme1n1p1 which is the efi partition and it's using refind instead of grub. When you install windows it automatically creates a boot partition which used to be nvme0n1p1. Stuff like os-prober look for this partition when detecting windows installs.
I am not understand your comment correctly. To me it sounds like I can copy some stuff from the main windows partition and copy it into the linus boot partition and create a bootloader entry that can then boot into windows. Is this correct?
Yea, though not the main windows partition since it doesn't have the boot files, but a windows installer iso.
You are gonna have to help me out more because it seems there never was a windows boot partition and you were right. There is a windows reserved partition and the actual c:\ partition. So my guess is that the windows boot files were on the partition that also housed the linux boot stuff (refind and so on).
So I tried using the command prompt from a live Windows USB. But I could not mount the linux boot partition at all. It is a normal fat32 partition but Windows does not recognise it as such. It could be because of the way it was created: i copied some mkfs command from a guide. Because of this I could not assignletter this partition or do any of the cmd sorcery I found online.
I guess I could try recreating this partition in a way that Windows is not deeply offended by it. But apart that I am out of ideas.
Hmmm I don't know why that could be. Did you set it as an EFI partition? Check that, and if you currently can't do it, you could try your idea, or copy the windows boot files to some other drive and then copy those to the efi partition using Linux. You could also install windows or grab the windows files on some other unrelated computer (assuming it'd use efi).
I looked into it today and turns out the whole disk that the partition is on was using the dos table rather than gpt. I really don't know how I did that but that is besides the point. So I ended up having to nuke the whole disk and reinstall linux. Haven't yet tried to have windows boot yet but at least found out one thing that was wrong.