0

This question already has an answer here:

SSD - Windows 8.1 initially booting in GPT/EFI. Shrunk partitions using Gparted to create space for Ubuntu Installs. Also created 128MiB bios_grub partition. Installed Ubuntu 16.04 ( In legacy MBR mode with Grub ). All is well for a while both Windows and Ubuntu boot happily. Windows 8 suddenly stops booting but Ubuntu is just fine. When I use Windows USB recovery all is lost. Nothing boots. I know the files are there and can be found using foremost etc but cannot get proper filenames and folder structure is lost.

Boot from LiveUSB to inspect disk. Not all partitions are visible. Only the first 3

/dev/sda1       2048   2050047   2048000  1000M Microsoft basic data
/dev/sda2    2050048   2582527    532480   260M Microsoft basic data
/dev/sda3    2582528   4630527   2048000  1000M Microsoft basic data

Tried Testdisk with which I have had reasonable success in the past. However Testdisk also is unable to find all my partitions.

Recreated partitions upto sda7 using gdisk. Now fdisk reports only 1 partition.

$ sudo fdisk -l /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 525.1 GB, 525112713216 bytes
255 heads, 63 sectors/track, 63841 cylinders, total 1025610768 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: 0xb7687035

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1  1025610767   512805383+  ee  GPT

    $ sudo gdisk -l /dev/sda
    GPT fdisk (gdisk) version 0.8.8

    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present

    Found valid GPT with protective MBR; using GPT.
    Disk /dev/sda: 1025610768 sectors, 489.0 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): -------------------
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 1025610734
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 612129757 sectors (291.9 GiB)

    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048         2050047   1000.0 MiB  2700  Basic data partition
       2         2050048         2582527   260.0 MiB   EF00  EFI system partition
       3         2582528         4630527   1000.0 MiB  EF00  EFI system partition
       4         4630528         4892671   128.0 MiB   EF02  
       5         4892672       197482495   91.8 GiB    0700  
       6       197482496       397481983   95.4 GiB    8300  
       7       397481984       413482991   7.6 GiB     8200  

Original SSD was.

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: gpt
Disk identifier: ---------------------

Device         Start       End   Sectors   Size Type
/dev/sda1       2048   2050047   2048000  1000M Microsoft basic data
/dev/sda2    2050048   2582527    532480   260M Microsoft basic data
/dev/sda3    2582528   4630527   2048000  1000M Microsoft basic data
/dev/sda4    4630528   4892671    262144   128M BIOS boot
/dev/sda5    4892672 197482495 192589824  91.9G Microsoft basic data
/dev/sda6  197482496 397481983 199999488  95.4G Linux filesystem
/dev/sda7  397481984 413482991  16001008   7.6G Linux swap 
/dev/sda8  413485056 ?????????  ????????   Approx 170G Microsoft basic data   
/dev/sda8  ????????? 896514047  ????????  Approx 60G  Linux filesystem
/dev/sda9  896514048 948942847  52428800    25G Microsoft basic data
/dev/sda10 948942848 976773119  27830272  13.3G Microsoft basic data

Originally sda8 was
/dev/sda8  413485056 896514047  483028992 230.3G Microsoft basic data

I would really like "sda11" back and bootable but can manage with the files from sda11. My 2 cents is that I think the MBR partitions are lost because Windows recovery tried to make everything GPT/EFI. Recreating the partitions using gdisk doesn't help but the window NTFS partition should still be mountable. However this complains NTFS signature missing. Likewise for the linux partition sda6.

$ sudo mount /dev/sda5 mnt
mount: block device /dev/sda5 is write-protected, mounting read-only
NTFS signature is missing.
Failed to mount '/dev/sda5': Invalid argument
The device '/dev/sda5' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

Also is there a way to just mark a partition to be of a certain filesystem without destroying the data.

marked as duplicate by Andrea Lazzarotto, Zanna, user364819, Eric Carvalho, Charles Green Jul 4 '17 at 3:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • First mistake... Windows and Ubuntu should be installed in the same mode... either BIOS or UEFI. Second mistake... since you've rewritten the partition table and written to the disk, I think that the chances of any recovery are gone. I'd suggest you just start over, installing both OS in UEFI mode. – heynnema Jul 2 '17 at 15:30
  • I can see the data is still there. Foremost is able to find the files. In any any case I have only written the partition tables so all partition filesystems should be intact. Tesdisk does this too when it discovers the partitions. I already have most of the partition table data. This is precisely why I have not formatted any partitions and refrained from using mkfs to mark the partitions file-systems. – user2994430 Jul 2 '17 at 15:52
0

You've made some fundamental mistakes, apparently as a result of some misunderstandings, so I feel compelled to address them first. You wrote:

Now fdisk reports only 1 partition.

This is normal for old versions of fdisk used on a GPT disk. Part of GPT is a "protective MBR," which is basically an MBR partition table that claims the disk is fully occupied by a partition of type 0xEE. The point of a protective MBR is to keep GPT-unaware tools from messing with the disk. It does not indicate any sort of damage. Your MBR partitions have not been "lost" (as you wrote elsewhere), since you never had MBR partitions.

Note that fdisk even informed you of its lack of GPT awareness, and told you what to do:

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.

(gdisk works on GPT disks, too, and is more similar to fdisk than parted in its user interface.)

Windows 8.1 initially booting in GPT/EFI.

My 2 cents is that I think the MBR partitions are lost because Windows recovery tried to make everything GPT/EFI.

Windows ties its boot mode (BIOS/CSM/legacy vs. EFI/UEFI) to its partition table type (MBR vs. GPT) quite tightly, so if the disk was originally booting in EFI mode, it must have used GPT. This is entirely consistent with everything else you've shown. A Windows recovery tool should try to make such a system boot in EFI mode, and as I've already noted, you had no MBR partitions to lose. Thus, this situation is one of, as they say, "move along; nothing to see here."

I would really like "sda11" back and bootable

You've shown no indication that you ever had a /dev/sda11. Your listing of what was originally on the disk indicates you had /dev/sda1 through /dev/sda10, inclusive. If there are any significant gaps between these partitions or at the start or end of the disk, I'm missing them.

It looks like most of your partitions are either intact or can be recovered by TestDisk or something similar. It appears that /dev/sda8 is a problem, though; it may have filesystem damage. Likewise for /dev/sda5. As those were both originally NTFS volumes, you should ask about them on a Windows forum. The only NTFS "repair" tool for Linux, ntfsfix, is very basic -- it does some extremely simple checks, repairs one or two trivial things, and flags the filesystem for repair in Windows.

It seems that you know the exact original start and end points for your partitions. You can plug those values into gdisk to re-create the partition; but of course if the Windows repair tool you used tried to resize the partition, those values may no longer be valid.

Also created 128MiB bios_grub partition. Installed Ubuntu 16.04 ( In legacy MBR mode with Grub ).

Dual-booting with one OS in EFI/UEFI mode and the other in BIOS/CSM/legacy mode is possible, but awkward. It's almost always better to install both OSes in the same mode. See my page on the CSM for much more on this subject.

Moving ahead with recovery, I recommend you disable the CSM and recover or re-install Ubuntu in EFI mode. (The bulk of the installation needs no changes; you just need an EFI-mode boot loader, and perhaps an edit to /etc/fstab to mount your EFI System Partition [/dev/sda2 or /dev/sda3; you seem to have two of them] at /boot/efi.)

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