0

I had a working system with dual boot of Win 10 and Ubuntu 18.04 on a single hard disk with the following partition layout (more or less, that is what I remember): - Primary NTFS, 1.5gb boot - Primary NTFS, 120gb win10 - Primary Linux, 100gb Ubuntu, divided to 3 partitions: * Extended 2gb where /boot is mounted * Logical 20gb where / is mounted (OS) * Logical 100gb where /home is mounted

I needed more space for the Ubuntu partition, so I resized the win10 partition. I don't remember if I did it from Ubuntu or win10, but after that Ubuntu stopped booting. I managed to fix it using testdisk, but then win10 stopped booting. The situation now is that when I recover the win10 partition using testdisk it boots, but Ubuntu doesn't. When I recover the Ubuntu partition (also with testdisk) it boots, but win10 doesn't.

Currently I'm in the "win10 boots and Ubuntu doesn't" state. When I boot with a Ubuntu Live CD, this is the output of fdisk -l /dev/sda:

Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8f76ec72

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048   3074047   3072000   1.5G  7 HPFS/NTFS/exFAT
/dev/sda2         3084480 244380779 241296300 115.1G  7 HPFS/NTFS/exFAT
/dev/sda3       244381696 248381439   3999744   1.9G 83 Linux

So the 2 partitions at the start of the disk are identified correctly, but 2 out of 3 linux partitions aren't.

The analysis of testdisk is:

Disk /dev/sda - 250 GB / 232 GiB - CHS 30401 255 63

     Partition                  Start        End    Size in sectors

 1 * HPFS - NTFS              0  32 33   191  89 26    3072000
 2 P HPFS - NTFS            191  89 27 12602  29 35  199378944
 3 P Linux                15212  14 35 15461   7 34    3999744
 4 E extended LBA         15461   7 35 30401  75 10  240015360
 5 L Linux                15461  40  4 17911 157 38   39366656
 6 L Linux                19903 134  8 30401  75 10  168646656

So it identifies correctly the linux partition structure, but if I recover it it messes the windows partitions. Note that in this situation the win10 partition has its size before I shrinked it (~120gb) but testdisk identifies it with size after the shrinking (~100gb)

Any way to recover it correctly?

Itamar Katz
  • 171
  • 5
  • 1
    Microsoft has a bug (since forever) which it may call a "feature". It does not write logical Linux partitions back into partition table. So you resized with Windows which is preferred but with 35 year old MBR configuration, you have the issue. If you know start & end sectors: Parted rescue seems easier than testdisk https://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition or maybe testdisk: Be sure to backup partition table first & best to have system fully backed up. https://ubuntuforums.org/showthread.php?t=2288988 – oldfred Apr 16 '20 at 16:05
  • Thanks, I backed up of course and tried a partition table offered by testdisk that resembled what I remembered before the size change, and it worked (I will update in an answer) – Itamar Katz Apr 17 '20 at 10:37

1 Answers1

0

I ended up giving testdisk another try. This time I used the 'deep search' option and got a huge list of deleted partitions. Luckily only 1 combination of the resized Win10 partition + Linux extended partition fitted what I remembered was the situation before I attempted the resize. So I backed up the whole drive, and gave it a try. It worked.

Itamar Katz
  • 171
  • 5
  • Glad that worked. Testdisk typically finds all the old partition configurations. And a user has to select only those old partition that make up a non-overlapping configuration, hopefully newest or last version. – oldfred Apr 17 '20 at 13:49