I believe I did this before, but it has been a while since I reinstalled Windows.
I have an old laptop that's quad-booting (Ubuntu & Windows are in one drive). If you have Windows 10 on the same disk, you can select the largest Windows partition (the NTFS one) at install time (I think even if you delete every partition Windows uses, recreating it from the freed space shouldn't touch the other partitions).
Assuming GRUB disappears, you can 1) select the Ubuntu partition at boot time, or 2) create an Ubuntu live USB, and reinstall GRUB.
When you reinstall GRUB, you have to make sure that you mount the Ubuntu partition & the EFI partition. I'm going by memory so I suggest you or someone here look it up to make sure that I was correct or didn't make a typo:
- List the disks that are in your system.
sudo fdisk -l
It'll have an output similar to this
Disk /dev/sda: 238.49 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Samsung SSD 850
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BD7EBAEA-CA89-424C-99FC-914DB87E6AC9
Device Start End Sectors Size Type
/dev/sda1 2048 976895 974848 476M EFI System
/dev/sda2 976896 499337215 498360320 237.7G Linux filesystem
If you have an NVME drive, instead of something like "sda1", it'll look like something like "nvme0n1p1"
We'll use my output as an example. I bolded the ones you should pay attention to.
- Mount the Ubuntu partition & install GRUB
su
mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot/efi
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-install /dev/sda
update-grub
Unmount the partition and restart
exit
umount /mnt/sys
umount /mnt/proc
umount /mnt/dev/pts
umount /mnt/dev
umount /mnt/boot/efi
umount /mnt
restart
Found a post in Ask Ubuntu that might help under the title "How can I reinstall GRUB to the EFI partition?". This forum wouldn't let me paste that link.