0

I have a dual boot with Ubuntu and Windows 10. I have only booted into Windows a handful of times over the last 2 years or so. I left Windows logged in overnight and it decided to update. The next morning I was greeted with grub rescue.

Following the instructions of similar questions on here, I went through each partition looking for signs of Linux using ls and then ls (hd#,msdos#) for each partition shown. Nothing. I then used a bootable Windows USB drive to get to the command prompt and tried the following. I don't remember if I ran the bcdedit or bootrec command first.

bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi
bootrec /fixmbr
bootrec /fixboot
bootrec /rebuildbcd

This didn't fix anything and I used the Windows startup repair tool to get into Windows. Once in Windows I created a bootable Ubuntu USB drive, and booted into a live Ubuntu session. I ran the recommended function of the Boot-Repair utility and foolishly didn't save the Pastebin link. It completed successfully, but did not fix the Ubuntu boot partition and also broke ability to boot into Windows. I used the bootable Windows USB drive once again to run the startup repair tool to get back into Windows.

From here I ran the testdisk utility which sees the partition, but is unable to recover it. Testdisk partition table backup:

#1611976403 Disk /dev/sdb - 500 GB / 465 GiB - CHS 60801 255 63
 1 : start=     2048, size=  1124352, Id=07, *
 2 : start=  1126400, size=346499072, Id=07, P
 3 : start=347625472, size=104857600, Id=83, P
 4 : start=452483072, size=524288000, Id=05, E

(I initially had individual screenshots for each step below but then realized I cannot post more than 8 links without enough reputation points so here is the whole album https://i.stack.imgur.com/iIrlc.jpg )

Windows Disk Manager sees this as free space. (see screenshot)

Gparted gives an "invalid partition table --wrong signature" error when loading. If I ignore this error it shows unknown/unallocated spaces. (see screenshot)

fdisk -l returns similar results (see screenshot)

If I understand correctly, sbd5 is the result of moving partitions around in the past? TestDisk also has a "The hard disk seems too small" error (see screenshot).

The Disk tool shows an extended partition 4 alongside Free space. However, the sizes are incorrect. Windows disk management, GParted, and fdisk correctly show sizes of 250GB and 50GB for the two inaccessible partitions, the Ubuntu disk tool shows 268GB and 58GB. (see screenshot)

TestDisk Analyse shows: https://i.stack.imgur.com/UckRi.jpg

TestDisk Quick Search results in a partition that cannot be recovered and an error that the hard disk seems too small (remnants of adjusting partition sizes in the past?):

enter image description here

Continuing to the next screen:

enter image description here

Quick search results:

enter image description here

I can view files in the FAT32 LBA and Linux partitions, though the Linux partition is obviously missing a lot of files.

The next screen displays "No partition found or selected for recovery." After the deeper search I see the same "hard disk seems too small", "following partition can't be recovered", and warning about the number of heads per cylinder as the quick search (screenshots above), then:

enter image description here

The first Linux partition is the same as one shown in the quick search, the others all say "No file found, filesystem may be damaged."

If I go to geometry and change the number of heads to 128 as suggested, I see the following in Analyze.

enter image description here

And then get the same results as before with the quick search and deep search, except for warnings regarding a mismatch in number of heads/cylinder.

I booted back into the Ubuntu live instance and reran Boot-Repair, but just ran the Boot-Info option this time since I figured that running the boot-repair again would just have the same results as above (breaking the windows boot and having to rerun the Windows repair utility - potentially making matters worse?), but this time I saved the Pastebin log.

At this point I don't know what else to try. Am I screwed? I have not written any changes to the partition tables with TestDisk nor have I made any changes with fdisk. Is there any way to recover the Linux partition(s) or at least (some of) the data contained within? I was able to create an image of the 250GB partition in question using TestDisk.

  • Please use tools from LINUX/Ubuntu We can only provide help for and from within Ubuntu. If you want help using windows tools you really need to ask windows users. – Rinzwind Jan 30 '21 at 17:53
  • @Rinzwind I have included all the steps I took using tools from both Windows and Ubuntu to provide as much context as possible. – Cheesecycle Jan 30 '21 at 19:46
  • This is a regular Windows BIOS/MBR bug (feature?), as it does not see logical Linux partitions in an extended partition. It rewrites partition table without Linux. 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 Parted rescue seems easier than testdisk https://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition & https://askubuntu.com/questions/944371/grub-and-ubuntu-disappeared-after-windows-update – oldfred Jan 30 '21 at 22:35
  • @oldfred Thanks for your help. I read through the links you provided and the ubuntuforums thread. I tried doing a parted rescue with a variety of start/end points and even though it shows the partitions when I do parted /dev/sdb unit s print, it does not find them when I attempt a rescue. I also get Error: Invalid partition table on /dev/sdb -- wrong signature d8b2. I'm not sure what this means and I'm not having any luck finding more details with a search. Full terminal text in pastebin link. https://paste.ubuntu.com/p/c2wqbNvDyK/ – Cheesecycle Jan 31 '21 at 15:38
  • It looks like the entire extended partition is empty and would have your partition(s). But how many did you have and any estimate of sizes? An older install would have / (root) & swap and maybe you have others like /home or /boot. Then start is a sector or two after start of extended but end varies? It looks like testdisk found /boot & / and shows size in sectors. So started at start of extended & using sizes from testdisk should give you end of /boot and new start of / & end? – oldfred Jan 31 '21 at 18:11
  • @oldfred 50GB and 250GB should be the correct sizes for /boot and /. I am not sure what is up with the sizes testdisk shows after the scan, though the initial sizes from the analyse screen look correct. Despite this, I tried doing a parted rescue using the boot and rootfs sizes as you suggested, to no avail. I did find disk image backups of /root and / from august of 2020, the last time I adjusted partition sizes. They were 21.5GB and 136.3GB before being adjusted to 50GB and 250GB. – Cheesecycle Feb 01 '21 at 16:05
  • Could the error invalid partition table -- wrong signature d8b2 be preventing partition rescue? Do you know anything about this? – Cheesecycle Feb 01 '21 at 16:05
  • UEFI uses a signature to know if gpt or MBR(msdos). But it looks like you are using the old BIOS/MBR configuration for installs. Is system UEFI? Windows in BIOS boot mode requires MBR, and requires gpt for UEFI boot. Ubuntu can boot in either mode from either partitioning, but should match Windows if dual booting. Not sure why testdisk still uses CHS, cylinders, heads, sectors when all drives for years are LBA. Did your UEFI/BIOS change to IDE from AHCI for drives? – oldfred Feb 01 '21 at 19:41
  • @oldfred Yes I am using the BIOS configuration. I'm not familiar with UEFI, but I do know that when I was booting into the Windows recovery USB drive I do not have any UEFI options. I have also been unable to access the BIOS setup since this problem has started, though I just rebooted to check the POST information and was able to get into the BIOS setup for the first time. Previously it would hang after checking the drives. I do not know if the BIOS was set to IDE before, but it is definitely set to AHCI now. Should I try changing it to IDE? Thanks for walking through all this with me! – Cheesecycle Feb 02 '21 at 14:33
  • You need AHCI with your system. If you have a fast boot setting, then you may not be able to get into UEFI as it assumes no changes and immediately boots, giving no time to press any keys. Full "cold" boot or total power down & drain all power usually causes a normal boot. Is system set to boot in CSM/Legacy/BIOS mode, not UEFI? – oldfred Feb 02 '21 at 15:19
  • While I am running up-to-date OSes, I have older hardware (AMD Phenom II X4 ~ 10 years old), if that matters. Fast startup is disabled through the windows power options and I do have time to press the keys to enter the various setup interfaces. "Is system set to boot in CSM/Legacy/BIOS mode, not UEFI?" I am not sure how to check or change this. Just tried rebooting into BIOS setup and can no longer get in. It hangs on this screen as it did before. Prior to this issue I had no problems getting into the BIOS setup. https://imgur.com/VcTEqj9 – Cheesecycle Feb 02 '21 at 15:43

0 Answers0