TL/DR: Use extended partitions for Linux in a dual-boot setup with Windows 10 — otherwise you might not be able to boot after a Windows update.
A few days ago I had to fix a dual-boot setup consisting of a Windows 10 and a Linux (Ubuntu) system. After deploying the latest Windows 10 Anniversary Update neither Linux nor Windows was accessible anymore. Only the GRUB rescue prompt appeared:
error: unknown filesystem. Entering rescue mode... grub rescue>
GRUB wasn’t even able to manually boot into the Windows or Linux partition.I booted into an Ubuntu live system (via USB stick) and examined the hard drive. The first thing I noticed was that the partition layout had changed significantly. Before, there were four primary partitions on the system, two for Windows and two for Linux. (In this situation I did not think about making screenshots so I had to retype the following dialogs based on my memory.)
Number Size Type 1 0.49GiB primary ntfs boot 2 117GiB primary ntfs 3 314GiB primary ext4 4 15.9GiB primary linux-swap(v1)
At some point during the Windows update the partition table was modified: the Windows partition (2) was resized and a Windows rescue/update partition (3) was created. The Linux partition disappeared.
Number Size Type 1 0.49GiB primary ntfs boot 2 116GiB primary ntfs <--- Slight change in size 3 0.82GiB primary ntfs diag <--- Different partition 4 15.9GiB primary linux-swap(v1)
Due to this modified layout GRUB was unable to find its stage 2 which consists of files located on the Linux partition (/boot/grub).
Still being in the live system I ran testdisk to identify and recover the previous partition layout. It worked, testdisk was able to detect it — but this led to a decision I had to make which made me a bit nervous: I would have to remove the Windows 10 rescue/upgrade partition in order to get back my Linux partition!
Maybe some background: The (old) MBR partition table format is limited to four primary partitions. Additional partitions are created as logical partitions within an extended partition, a special form of primary partition. (The newer GPT partition layout does not have such a (strict) limitation.)
I tried something different by removing the SWAP partition and restore both, the Windows rescue and the Linux partition. GRUB was able to at least manually boot into Linux (the partition numbering had changed.). Windows seemed to boot but crashed after a few seconds. Windows’ own repair functions failed to recover the system.
Number Size Type 1 0.49GiB primary ntfs boot 2 116GiB primary ntfs 3 0.82GiB primary ntfs diag 4 314GiB primary ext4
Just out of curiosity I manually restored the original layout by removing the Windows update/rescue (ntfs diag) partition, resizing the main Windows partition, and re-enabling SWAP. Windows still did not boot up, but at least I gave it a try.
I finally reinstalled the whole dual-boot system — this time with Linux + SWAP on extended partitions. (I wanted to do that for quite some time but always had other more important things to do…) I did not loose any data but it did cost some time get everything up and running again.