1

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
    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?

JB_User
  • 383
  • 1
  • 4
  • 14
  • Win10 uppdate repartitions the drive and deletes linux partitions. try testdisk to recover the partitions, in most cases it will boot normally after recovery – ravery Oct 02 '17 at 17:07
  • Are you kidding or are you serious? Does WIn10 update really delete Linux partitions? How do I get testdisk? – JB_User Oct 02 '17 at 17:09
  • yes I am serious. testdisk is in the repo `sudo apt-get install testdisk` – ravery Oct 02 '17 at 17:11
  • It's true. See [this](https://www.partitionwizard.com/partitionmanager/partition-disappears-in-win-10-anniversary-update.html) – Redbob Oct 02 '17 at 18:06
  • 1
    It not just Windows 10, this Windows bug has been there since Windows 7. often a reinstall of Windows 7 did same. Windows updates partition table but "forgets" to write logical Linux partitions. See http://askubuntu.com/questions/654386/windows-10-upgrade-lead-into-grub-rescue/655080#655080 Parted rescue seems easier than testdisk http://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition/665462 – oldfred Oct 02 '17 at 19:00

1 Answers1

4

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

Update:

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

heynnema
  • 68,647
  • 15
  • 124
  • 180
  • I had previously tried booting a Ubuntu Live USB but that failed. I get to the point where the screen is blinking on and off every second or so. Something isn't right. And I can't consistently boot to that point with the Live USB. RIght now the problematic hard drive is mounted in an external drive enclosure on a working Ubuntu machine. I hope to fix from that machine. – JB_User Oct 02 '17 at 21:01
  • I think you are right in tha tthe missing partition is between 1015GB and 1983GB. However, there are two missing Ubuntu partitions in there. – JB_User Oct 02 '17 at 21:12
  • Why do you think there were two Ubuntu partitions there? Also, the partition has to end before 1983GB, 'cause that's the start of the swap partition. That's why I said 1983GB-1. The problem booting the Live USB may be with your video card... use the `nomodeset` parameter to get it to boot. Lastly, you can install `testdisk` on your working Ubuntu machine. – heynnema Oct 02 '17 at 23:02
  • Also, with a 2TB HDD, you should be using GPT formatting. Is your computer UEFI? – heynnema Oct 02 '17 at 23:07
  • I don't know how to answer that. It is a fairly new PC (purchased in 2016 April). I knew the answer to that at one time, but I do admin work so infrequently that I forget everything 18 months later when problems happen. Anyway, I'm not at the point where I can boot the machine into Windows, or either of the Ubuntu partitions. However, I have to go through the grub rescue mode to get there. Do you know how I can have grub load automatically? – JB_User Oct 03 '17 at 00:53
  • With the two Ubuntu partitions gone, so is GRUB, except for its initial loader. You'll have to use `testdisk,` or `parted` as referred to by others, to restore your partitions, so that GRUB will fully load and you'll be able to boot Windows/Ubuntu again. I think that there may be a way to manually boot Windows by using GRUB commands... `boot-repair` may be the easiest. Since your computer is only 1 year old, I'm 99% sure it must be UEFI, so the BIOS/UEFI should be set to UEFI mode, and your disk should be in GPT format. Enter your BIOS/UEFI and check that setting. – heynnema Oct 03 '17 at 14:32
  • See the update to the original text. The partitions are restored and I can reboot into Ubuntu or Win-10. However, I have to enter grub rescue mode to do it. Now I'm trying to figure out how to repair grub after the machine is rebooted into Ubuntu. grub-install? – JB_User Oct 03 '17 at 19:13
  • @JB_User the *easiet* would be to boot into Ubuntu manually, then do `sudo update-grub`. That may or may not be enough. Reboot and try it. If it doesn't work, you can either try reinstalling GRUB, or using `boot-repair`. – heynnema Oct 03 '17 at 19:21