0

I recently installed Ubuntu (14.04 LTS) on my laptop. I had a single SSD with windows 7 installed on it and decided to install Ubuntu in dual boot. From windows, I created 2 other partitions (15Gb) and 2(Gb) for Ubuntu and swap space, respectively. I was left with 4 partitions:

  • A ~200 Gb one with Windows 7 (#1)
  • A very small one (100Mb) related to Windows I guess (#2)
  • An empty 15 Gb one for Ubuntu (#3)
  • An empty 2 Gb one for swap space (#4)

I burned Ubuntu on a USB-stick and booted on it from BIOS (UEFI version 2.17). I then started to install Ubuntu. During installation, I selected "install Ubuntu along-side Windows 7". And I clicked on the "partition options". Which lead me to the partition screen, aka "Where I screwed up screen", which looks like this.

In this screen , I selected #3 for my root directory (with ext4 file system). I selected #4 for swap space. And I unselected #1 (the one with windows 7) by clicking on the "-" button when the partition was selected. Once unselected, the space was labelled as "free space", biiiig mistake.

Then I proceeded with the installation. Now, in the BIOS, when I select the device I want to boot on, the BIOS proposes me only one option (Ubuntu on my SSD), when I would like to see 2 of them (one for each OS).

I tried to boot on the USB-stick to see what happens. During installation, the #1 partition is not present anymore and I can only "install Ubuntu along-side Ubuntu".

If I run lsblk, I can see only 3 partitions (Ubuntu - 15 Gb, swap partion - 2 Gb and a small one - 1 Kb).

Now given this situation, I would like to know if the "lost" partition can be recovered ? I guess that the master boot record was changed and windows address was replaced by Ubuntu's address. But does it mean that the partition with Windows was totally erased ? Or that it's just not referenced anymore ?

I would like to try to add the lost partition to my partition table. On Ubuntu website, I found a page (help.ubuntu.com/community/DataRecovery) that explains how to do it ? Should I give it a try ?

Well that's a lot of questions, I would be glad to hear any piece of advice from you !

Thank you very much

------ First EDIT --------

As suggested I ran TestDisk. Here are the first information that I gathered :

Disk /dev/sda - 256 GB / 238 GiB - CHS 31130 255 63 Current partition structure:

    Partition                  Start        End    Size in sectors
 3 E extended LBA         29058 101 34 29307 191 39    4005861
 4 * Linux                29307 192  6 31130 158  4   29284352
 5 L Linux Swap           29058 101 36 29307 191 39    4005859

It corresponds to my #3 and #4 partitions (given sectors of 512 Bytes). But I don't get why two of them overlap ? What is extended LBA ?

Then I launched a "quick search" and got those results :

Quick search

Disk /dev/sda - 256 GB / 238 GiB - CHS 31130 255 63
     Partition               Start        End    Size in sectors
   HPFS - NTFS              0  32 33    12 223 19     204800 [System Reserved]
   HPFS - NTFS             12 223 20 29058  69  3  466614272 (my "lost" partition" !)
   HPFS - NTFS          29058 101 36 29307 192  5    4005888
   Linux                29307 192  6 31130 158  4   29284352

Here it is ! The second partition is a 238 Gb partition which contains the windows installation. I guess that the first one contains the GUID partition table ?

In an attempt to list the directories and files in the partition I pressed "p". Then TestDisk crashed. Should I run Linux from my USB-stick instead of my actual SDD to do that ?

In any case, now I would like to tell TestDisk to add the "lost" partition to that partition table. I'm not sure how to do this and don't want to mess up again ! Could anyone help me ?

-------------EDIT 2---------------

I did the next step in Testdisk (selected the partition and pressed "continue"). It proposed me a deeper search, which I did. The results are the following :

Disk /dev/sda - 256 GB / 238 GiB - CHS 31130 255 63
     Partition               Start        End    Size in sectors
>  HPFS - NTFS              0  32 33    12 223 19     204800 [System Reserved]
   HPFS - NTFS             12 223 19    25 159  5     204800
   HPFS - NTFS             12 223 20 29058  69  3  466614272
   HPFS - NTFS             12 223 20 31130 190 36  499908608
   Linux                 1318  42  5  1970 222 44   10485760
   Linux                 8911 129 51  9564  55 27   10485760
   Linux                 8923 158  4  9576  83 43   10485760
   Linux                 8948  89 38  9601  15 14   10485760
   Linux                10607   5 23 11259 185 62   10485760
   Linux                10640  74 59 11293   0 35   10485760
   Linux                27363   3 33 29712 194 50   37748736
   Linux                27616  49 18 29965 240 35   37748736
   Linux                27635  80 30 29985  16 47   37748736
   Linux                27636 118  3 29986  54 20   37748736
   Linux                27639  35 45 29988 226 62   37748736
   Linux                27642 115 58 29992  52 12   37748736
   Linux                27663 222 16 30013 158 33   37748736
   Linux Swap           29058 101 36 29307 192  5    4005888
   HPFS - NTFS          29058 101 36 29307 192  5    4005888
   HPFS - NTFS          29058 101 36 29307 192  5    4005888
   Linux                29307 192  6 31130 158  4   29284352


Structure: Ok.  Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
*=Primary bootable  P=Primary  L=Logical  E=Extended  D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
     Enter: to continue
NTFS, blocksize=4096, 104 MB / 100 MiB

It found several Linux partitions that overlap and I'm really not sure what they are. My guess would be that they come from some Virtual machine images that I had downloaded. Whatever, the only partition that I'm interested in is the third one (238 Gb).

If I press continue again I get a message like "no partition found" and it goes back to the menu.

I tried with gparted but it was taking forever... strange.

1
  • Not sure why using p crashed the program. What you are meant to do at this point is to press Enter and to go to the next step. What the guide says there is that "When all partitions are available and data correctly listed, you should go to the menu Write to save the partition structure. The menu Extd Part gives you the opportunity to decide if the extended partition will use all available disk space or only the required (minimal) space", so check CAREFULLY if EVERYTHING it's present and match, if you're not sure post the output of this last step along with a screenshot of gparted
    – kos
    Commented Mar 12, 2015 at 19:22

2 Answers 2

0

I'd suggest you to use testdisk in Ubuntu:

sudo apt-get install testdisk

Or download it through Ubuntu Software Center.

In either cases, make sure that the Universe repository is enabled in /etc/apt/sources.list or in Software Updater.

You can run testdisk like so: sudo testdisk

The steps required in order to recover your deleted partition vary based on your configuration and based on testdisk's capability to recognize the deleted partition, so i can't give you exact instructions, but try to follow the on-screen instructions provided by the program itself. Plus, if you need further reference, here's a good step-by-step guide to partition recovery provided by the testdisk wiki itslef

1
  • Thanks ! I ran a first test with TestDisk. I edited my post and added the results to it.
    – user427357
    Commented Mar 12, 2015 at 17:54
0

Okay here is how it ended.

I installed a Ubuntu update and I rebooted my system. Unfortunately, the login screen never appeared and I got stuck with a black screen with a blinking cursor. I googled the problem and tried a few things but nothing solved the issue. So I decided to reinstall Ubuntu over my current version.

I got a warning saying that one partition will be changed (it was the one I had Ubuntu installed on). I continue. After the installation is done, I did a quick check with testdisk and was horrified when I see that the Ubuntu had not been installed as the warning suggested. It got installed in the "free space" (my "lost" windows partition). So yeah I definitely lost my partition.

1
  • If you are the author of the question, it looks like you accidentally created two IDs, which will make it difficult to edit or connect your own posts. See this link: superuser.com/help/merging-accounts. If you aren't the author of the question, this wouldn't be an answer.
    – fixer1234
    Commented Mar 13, 2015 at 4:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .