How to repair a Windows Boot loader damaged by GParted?

11,944

For all currently supported versions of Ubuntu, open the terminal and type:

sudo add-apt-repository ppa:yannubuntu/boot-repair  
sudo apt update  
sudo apt install -y boot-repair
sudo boot-repair  

enter image description here

Share:
11,944

Related videos on Youtube

Juracy Emanuel
Author by

Juracy Emanuel

Updated on September 18, 2022

Comments

  • Juracy Emanuel
    Juracy Emanuel almost 2 years

    My notebook has two disks (there is a third disk -/dev/sdb - that is cache for the second disk).

    Windows 10 is on the second disk (/dev/sdc) (SATA ODD) and was working very well until today.

    Ubuntu I installed yesterday on the first disk (/dev/sda) (Fixed HDD).

    Ubuntu is normal at this moment.

    My problem started today after I executed GParted in Ubuntu. I received the following pop-up message:

    Bug found in libparted! The Backup GPT Table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?

    Unfortunately, I pressed the button to execute the process. I was expecting that it would alter the disk (/dev/sda) in which it was running. But it changed the disk (/dev/sdc) with Windows.

    After that:

    1. UEFI does not found Windows;
    2. In Setup, SATA ODD appears as [Not Detected];
    3. DiskPart (list disk command) running using the recovery disk of Windows could not see the second disk (/dev/sdc/). It found 2 disks: /dev/sda and /dev/sdb was correct and with GPT.

    In Linux /dev/sdc is visible using: lsblk, fdisk, and parted.

    I was able to mount the partitions of the second disk (/dev/sdc/) and access the files (as read only).

    Gdisk presented the following information for /dev/sdc:

    Problem: The secondary header's self-pointer indicates that it doesn't reside at the end of the disk. If you've added a disk to a RAID array, use the 'e' option on the experts' menu to adjust the secondary header's and partition table's locations.

    Identified 1 problems!

    Boot Info Script showed that:

    No boot loader is installed in the MBR of /dev/sdc. (disk with Windows)

    Windows is installed in the MBR of /dev/sda. (disk with Ubuntu)

    Could you help me to repair the GPT partition, or Boot Loader, of /dev/sdc (the second disk in which is Windows 10) ?

    An update:

    I removed the disk (/dev/sdc/) from the notebook. I put it in a adapter to use HDD SATA with USB conector.

    And in this way DISKPART was able to see the disk and its partitions/volumes. Identifying it as GPT.

    Now I just need to recover the windows bootloader for the disk. (I have the recovery disk created using the system, and the Windows 10 installer both in pendrives).

    What is the safest procedure to do that ?

  • Wyatt Ward
    Wyatt Ward over 8 years
    more ubuntu-specific than my answer, but very good since the asker asked about Ubuntu.
  • Juracy Emanuel
    Juracy Emanuel over 8 years
    Karel, I tried your solution and it worked. Thanks for you that pointed the solution and Yann that developed it.