I have tried to upgrade my windows from 7 sp 1 to 10 using the MediaCreationTool.exe as suggest in this page - howtogeek. It did not work as suggested and part way through the upgrade I was faced with a grub rescue prompt. I found some help with this at this page - grub-rescue. I couldn't make the highest voted method work due to being unable to find the bootable partition using ls (hd0,msdos6)/ etc. etc., so used the second highest voted method which requires booting from a rescue-usb and running boot-repair. The boot-repair log is here - pastebin. During the boot-usb session I noticed that the linux partitions are marked as unknown. Upon restart the windows 10 upgrade continued and finished as expected, except the boot menu doesn't appear with the option to boot into Ubuntu. I tried the advice on this page - boot-repair doesn't work. Setting both bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi and bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi in windows commandline with admin privilege didn't help. I tried to run TestDisk to regain the partitions that were lost. I am completely confused how to do this correctly. When I run TestDisk the list of partitions look like this after the quicksearch.

enter image description here enter image description here enter image description here enter image description here enter image description here

I need to get them back to the way they were and feel way over my head with the options available. Help will be much appreciated. If anyone can just inform me which were my primary, logical and extended partitions it would help.

edited -

the output of sudo fdisk -l during the usb recovery session is:

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x75487944

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      409599      203776    7  HPFS/NTFS/exFAT
/dev/sda2          409600   124969634    62280017+   7  HPFS/NTFS/exFAT
/dev/sda3       124971006  1465147119   670088057    f  W95 Ext'd (LBA)
Partition 3 does not start on physical sector boundary.
/dev/sda5      1435705408  1464936447    14615520    7  HPFS/NTFS/exFAT
/dev/sda6      1464936511  1465147119      105304+   c  W95 FAT32 (LBA)
Partition 6 does not start on physical sector boundary.

Disk /dev/sdb: 2002 MB, 2002780160 bytes
62 heads, 62 sectors/track, 1017 cylinders, total 3911680 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
Disk identifier: 0x000a90a3

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          62     3909347     1954643    c  W95 FAT32 (LBA)

and the output of command sudo parted /dev/sda unit s print is:

Model: ATA Hitachi HTS54757 (scsi)
Disk /dev/sda: 1465149168s
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start        End          Size         Type      File system  Flags
 1      2048s        409599s      407552s      primary   ntfs         boot
 2      409600s      124969634s   124560035s   primary   ntfs
 3      124971006s   1465147119s  1340176114s  extended               lba
 5      1435705408s  1464936447s  29231040s    logical   ntfs
 6      1464936511s  1465147119s  210609s      logical   fat32        lba

I am suggesting that the partitioning scheme in testdisk could look like this below. Although I need advice on this.

Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63
     Partition               Start        End    Size in sectors
 P HPFS - NTFS              0  32 33    25 126 37     407552 [SYSTEM]
 * HPFS - NTFS             25 126 38  7779  21 50  124561408
 L Linux                 7779  86 52 22486  47 25  236265472
 L Linux                22486  79 58 87374 179 37 1042432000
 L FAT32 LBA            88123   6 12 89368   3 43   20000768 [OS_SHARED]
 L HPFS - NTFS          89368 101 14 91188  19 31   29233152
>P FAT32 LBA            91188  19 32 91201  52 51     210944 [HP_TOOLS]

I need to have the win10 partition (2nd NTFS partition) to be bootable and the linux partition (1st linux partitoin) to be bootable. It seems that making the linux partition logical is the only option, as otherwise I get Structure: Bad. instead of Structure: Ok.. Is it OK to play around with this a bit without destroying the data on the PC?

  • Post this: sudo parted /dev/sda unit s print Testdisk uses the old CHS, better to see exact sectors. But Windows typically forgets to write the Linux partition back into partition table. It looks like you have done several partition changes which makes it a bit more difficult to choose correct combintation of valid partitions. Best to backup current partition table. askubuntu.com/questions/654386/… or parted rescue: askubuntu.com/questions/665445/… – oldfred Jan 3 '16 at 16:31
  • I have edited the initial question. Hope this makes things clearer. – Jacques MALAPRADE Jan 3 '16 at 20:35
  • You may need boot repair after restoring partition, to just reinstall grub to MBR or manually reinstall grub to MBR. Did you make the backup of the partition table with sfdisk? Then you can try testdisk suggested solution. Others preferred the parted rescue solution. It looks like you missing partition starts just after the start of the extended at 124971006s plus one or two sectors and ends a few sectors before the start of sda5 1435705408s. – oldfred Jan 3 '16 at 23:09
  • No, I didn't make a backup using sfdisk. I guess I should have when I set up the partitions initially a while ago. So you learn. I did try and play around with testdisk but none of my suggested solutions worked. Isn't it maybe better to just remove/resize some of my partitions which aren't that critical. I was thinking of keeping the win10 (2nd NTFS), linux root / (1st linux) linux /home (2nd linux), OS_SHARED (1st FAT32), and add a Swap partition. Thats 5 partitions instead of 8 or so before. If possible how would you suggest I create primary (bootable?), extended and logical partitions? – Jacques MALAPRADE Jan 4 '16 at 10:47
  • Is it possible to convert my partitioning table to UEFI instead of BIOS which would make it simpler to just create primary partitions for everything? I have a Hitachi HTS547575A9E384 HDD. There seems to be page on how to convert this from BIOS to UEFI here. – Jacques MALAPRADE Jan 4 '16 at 11:28

Have you tried using boot-repair like this, and enter this in the terminal, and then run testdisk:

and first remove the old boot-repair

sudo apt-get purge boot-repair

and enter settings and remove repository, and then reboot and enter this:

sudo add-apt-repository ppa:yaunnubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
sudo apt-get update 
sudo apt-get upgrade 
sudo apt-get dist-upgrade

and use this settings advanced, and purge kernel, and install new one, and nomodset, and it might work fine.

  • Does this all take place during the usb boot session? I can't boot into Ubuntu on the HD. Windows 10 seems to have taken over my HD. – Jacques MALAPRADE Jan 4 '16 at 10:31
  • sudo add-apt-repository ppa:ubuntu/boot-repair doesn't seem to exist. Did you mean sudo add-apt-repository ppa:yannubuntu/boot-repair? – Jacques MALAPRADE Jan 4 '16 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.