Saturday 15 June 2024

How to fix Windows 10 boot after partition resize and change in number of partitions?

While inside Linux, if you use GParted to modify partitions (e.g., resize/insert/delete partitions), your existing Windows might not be able to boot. This tutorial help you recover Windows boot record for GPT disks.

Below are the steps:

1. Make sure your partitions are indexed in sequence, if you have inserted/deleted partitions, you will end up with `/dev/sda[1245]` without 3 or `/dev/nvme0n1p[1345]` without 2, use Linux command `gdisk` to re-index all the partitions on the GPT disk. Somehow, Windows bootloader does not boot if partitions are not in order.

2. Boot into any Windows installation CD and run the repair, usually this will not work (but if it works, then a good stop). Enter the command prompt in advanced settings.

3. Make sure both Windows main drive (C:) and EFI partition is assigned a drive letter. If not, run `diskpart`:

list vol
list disk
select disk #X
select partition #Y
assign letter=H
exit

4. Enter EFI partition H: and delete (or move to backup) existing EFI boot record for Windows:

rmdir /s EFI\Microsoft EFI\Boot

5. Rebuild EFI boot record

bcdboot
C:\Windows /s H: /f UEFI

6. (optional) If you just want to rebuild BCD entry (without rebuild the entire EFI boot entry), delete (or move to backup) the existing BCD file in EFI/Microsoft/Boot and run:

bootrec /rebuildbcd

No comments:

Post a Comment