Grub and Ubuntu disappeared after Windows update

Solution 1:

If you're on your Windows, search for 'Command Prompt' and run as administrator. Then, in the command line, type:

bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

Then, restart and you're good to go. If you want reverse your setting, type:

bcdedit /deletevalue {bootmgr} path \EFI\ubuntu\grubx64.efi

This is the simplest way to get grub back on your Windows.

Solution 2:

Windows 10 Anniversary Update, and I understand that Windows 10 Creators Update is the same, both can delete Linux partitions for no particular reason. It's not fully understood what factors trigger this action, however it might be related to MBR formatted disks.

Your sda4 is an extended partition that currently contains sda5 swap partition, and also held the previous Ubuntu partition, presumably sda6... which was located between blocks 253681662 and 484151295.

You can try using testdisk to recover your partition.

Boot to a Ubuntu Live DVD/USB, and in the terminal type:

sudo apt-get update

sudo apt-get install testdisk

sudo testdisk

See http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step for help on how to use this tool.

Solution 3:

To elaborate on heynnema's answer, Windows partitioning tools have LONG had bugs that cause them to delete logical partitions or convert them inappropriately to primary form, leading to serious problems. I tried Googling for examples, but I found just this one, concerning Windows XP. Windows XP! That's how long these bugs have existed. I'm 100% certain that there are other bug reports, but they're probably old enough that Google's not turning them up in the first couple pages of my search results. Since the release of Windows 8, the number of MBR-based installations has been dropping, so the number of problem reports has been shrinking.

In fact, I became so frustrated by problem reports about this sort of issue that in 2011 I wrote FixParts, which is based on (and part of) my GPT fdisk utility suite, installed in the gdisk package in Ubuntu. FixParts will not solve your specific problem, though; as heynnema says, you need TestDisk (or something similar to it) for that. I mention this as another illustration of how common and long-standing these Windows disk partitioning bugs are.

There is some practical advice to be gleaned from your situation:

  • Use Windows partitioning tools for as little as possible, especially on MBR disks and most especially on MBR disks with extended and logical partitions. Of course, a Windows update, such as you report having done, might be difficult (or at least undesirable) to avoid....
  • If you must use Windows partitioning tools, either directly or as part of something like the update you did, back up your disk first. This includes both a traditional file backup and a backup of your partition table. You can do the latter with a command like sudo sfdisk -d /dev/sda > parts.txt, which backs up the partition table on /dev/sda to parts.txt. If you need to restore that partition table, you'd use sudo sfdisk -f /dev/sda < parts.txt; however, if Windows has modified your partition table, it may have made a change that must be preserved (like resizing the Windows partition), so be wary. The backup might still be helpful in selectively recovering a deleted Linux partition, though. (An sfdisk partition table backup is human-readable, although you need to know a bit to understand its format.)
  • Use GPT and EFI installations rather than MBR and BIOS installations whenever possible. Because GPT doesn't use extended or logical partitions, the Windows tools' problems in handling them is unimportant for GPT disks. I'm unaware of any bugs in the Windows partitioning tool's handling of GPT disks that comes anywhere near the problem level of the bug you've encountered in its handling of MBR disks. Of course, if your computer is BIOS-only, this isn't an option; and converting from MBR/BIOS to GPT/EFI carries risks of its own and may be more bother than it's worth. (This Windows tool will do the conversion, if you want to look into it. Be aware, though, that I have no idea how well it would work with a dual-boot configuration.)