Ubuntu – Grub fails to boot after Windows upgrade


I have a multi-boot machine with a Ubuntu 14 partition, an ubuntu 16 partition and a Windows partition (probably Windows 10). I hadn't used Windows in over a year and after rebooting, it forced me into Windows updates. After that, my machine won't reboot. I get to the GRUB rescue prompt. The only error message is

error: no such partition

I could not run any useful commands from the GRUB rescue prompt, so I removed the hard disk and mounted it on a separate Ubuntu PC. I ran parted on the disk and this is what it looks like:

Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  525MB   524MB   primary   ntfs            boot
 2      525MB   1015GB  1014GB  primary   ntfs
 3      1015GB  1015GB  891MB   primary   ntfs            diag
 4      1015GB  2000GB  985GB   extended
 5      1983GB  2000GB  17.1GB  logical   linux-swap(v1)

I want to fix grub so it can multi-boot Windows (Partition 2), Ubuntu 14 and Ubuntu 16. I don't remember how I created the Ubuntu partitions, but I'm hoping they are somewhere in the extended partition 4 (maybe they are logical volumes?). Can I do this?

UPDATE: I was able to recover the two Ubuntu partitions with testdisk. I then rebooted into Ubuntu 14 via grub rescue mode. I think the hard part is done. Now, I have to get grub working correctly. Currently, this is what I have to do in order to get to the grub boot menu:

    set root=(hd0,msdos5)
    set prefix=(hd0,msdos5)/boot/grub
    insmod normal

How can I fix things so that grubs runs without having to go through the grub rescue prompt? Possibly load grub into the Master Boot Record?

Best Answer

Windows 10 Anniversary Update, and the more recent Windows 10 Creators Update, have a really bad habit of wiping out Linux partitions on MBR disks. Sounds like you're a victim.

Recovery is possible, but it can be tricky.

Boot to the Ubuntu Live DVD/USB.

Open Software & Updates and make sure that all of your software repositories are enabled.

In terminal...

sudo apt-get update # update the software database
sudo apt-get install testdisk # install testdisk
man testdisk # read the manual
sudo testdisk # start testdisk

You can also get specific instructions here: http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step


Your missing Ubuntu partitions were between partitions 4 and 5, and went from 1015GB to 1983GB-1.

Related Question