5

I recently updated my windows 7 to 10, and destroyed grub in the process. I ran Boot-Repair on a live CD and managed to get the Windows Partition back. However grub still doesn't come up for me.

The boot-repair url I received was http://paste.ubuntu.com/12189762/.

Edit:

Oldfred helped me figure out the problem. I didn't really understand how the partition worked. The extended partition wraps around both the linux and swap partition, but for some reason the linux partition was not showing up. I booted to a live disk and ran parted rescue:

sudo parted /dev/sda unit s print //this printed the current partition table

sudo parted
unit s
rescue
Start? //Here I entered in 1 sector after the extended partition
End? //Here I entered in 1 sector before the swap parition

After that I ran boot-repair again and was able to restore grub back in place! Everything is working great now. Hopefully this post can help someone else!

oldfred
  • 12,100

1 Answers1

3

It is not grub that is missing, but your Linux partition.

 /dev/sda2             208,894   416,761,855   416,552,962   5 Extended
 /dev/sda5         400,158,720   416,761,855    16,603,136  82 Linux
 swap / Solaris

You have a missing partition one or two sectors after the start of the extended and a few sectors before the start of sda5 swap. It probalby was sda5, and swap was sda6 but since using UUID to boot does not matter. Many use testdisk or parted rescue and reinstall grub to MBR and system works.

Backup partition table before any changes, so you can get back to current if changes not correct

sudo sfdisk -d /dev/sda > PT_sda.txt

More details:

Windows 10 upgrade led to grub rescue

Use parted rescue to restore missing partition details in post #22

http://ubuntuforums.org/showthread.php?t=1775331

http://www.gnu.org/software/parted/manual/html_node/rescue.html

oldfred
  • 12,100
  • Can you give me any more information on how to recover this partition? I have downloaded and run TestDisk, but it is over my head. I'm afraid to make and changes and ruin something.

    Is parted rescue easier to use? What range would I put into it then?

    I am running TestDisk again right now and taking screen shots. I found nothing on the QuickSearch but I'm doing the deeper search just in case. I'll upload the screens in the morning if that will help?

    – kvangent Aug 26 '15 at 03:01
  • I have not done the recovery, so do not know details more than what others have posted. Both have worked. But make the partition table backup as a few recover incorrect partitions and create more issues. You want all your existing partitions and one more logical L which includes the space in the extended partition. With parted rescue you may just be able to input sector after start of extended and sector before swap? – oldfred Aug 26 '15 at 03:43
  • As I said, I'm a complete novice when it comes to how partitioning works. I downloaded and ran TestDisk from my window side and have uploaded the results here: http://imgur.com/a/pYzct. I'm on the last frame but I'm not sure what I should do. I think when I hit enter it will change my partition table but I'm not sure? – kvangent Aug 26 '15 at 18:12
  • Did you back up partition table with sfdisk? If not do that first. Your quick search shows your existing partitions. And extended starts at 13,0,50, So I think the Linux partition that is deleted starting at 13,0,52 is the one you want to change from D to L. Only question is if you undelete that is that the only partition it writes or does it add it? IF you have the backup and it does not work you can easily restore to where you are now, and do it over. – oldfred Aug 26 '15 at 18:35
  • How can I back up the partition table with sfdisk? Will I have to switch back to the live disk? – kvangent Aug 26 '15 at 19:11
  • This is just a small text file of current partitions, but can be restored easily, if necessary. Backup partition table structure to text file & save to external device. sudo sfdisk -d /dev/sda > PTsda.txt & copy to another device. Some very advanced users may know how to manually edit the text file to add your partition, but better to use testdisk or parted rescue. – oldfred Aug 26 '15 at 20:37
  • TestDisk doesn't let me change the Partition 'Linux 13,0,52' to L. It only lets me change it to * (Primary Bootable) or P (Primary). Does this mean it's the wrong one? – kvangent Aug 26 '15 at 22:25
  • It should not let you change it to primary. It has to be inside the extended as shown. Do you have to select all the existing partition with their current *, P & L settings as shown and then add the missing one? You showed all the existing in one of your screen shots, I think it was from quick search. – oldfred Aug 26 '15 at 23:12
  • When I hit 'Quick Search' it pops up with img #2, then if I hit enter it shows up with img #3. Img #4 is when i hit deeper search and its finished, img #5 is what happens after I hit enter enter from #4 – kvangent Aug 26 '15 at 23:31
  • Last screen shows correct codes for current partitions, but second screen shows same partitions including your missing partition, but all as deleted. Change all the ones to type in last screen and change new Linux shown as D to L. It will automatically create an extended to include all logicals. – oldfred Aug 27 '15 at 03:45
  • Ok so I restarted TestDisk, did Quick Search, and got to the img @2. I tried to turn all the drive to what they were in the last page but it says 'Structure: Bad; http://imgur.com/7UDSvPw – kvangent Aug 27 '15 at 12:10
  • That looks right to me? But now all I can suggest is parted rescue. You input there sectors not CHS. Use one sector after start of extended and one sector before start of swap as starting point for search. – oldfred Aug 27 '15 at 13:13
  • Parted rescue worked perfectly! It look less than a second to find it and add it it into the partition table. I just ran boot-repair again and it reinstalled grub and everything is working correctly now! Thank you so much for your help! – kvangent Aug 27 '15 at 14:49