Ubuntu – Boot-Repair after messing up NTFS partition

12.04boot-repairntfspartitioningswap

I posted this question explaining what happened after I tried to create a new swap partition on a Win/Ubuntu dual-boot machine. I have since created a live-boot USB and installed Boot-Repair. I had it "recommend repairs", after which it tried repairing the wubi filesystems, which as far as I'm aware was not necessary. I'm not sure where to go from here; I don't care very much about backing up my files, I just want to be able to boot the machine.

In the Advanced Options

  • the "Repair Windows boot files" box is uncheckable

  • both GRUB tabs are unclickable (I do have GRUB installed)

Here is my Pastebinit with the details from the Boot-Repair. Please be as explicit as possible, as I am proving to be disproportionately bad at this type of task. Thank you!

P.S. I keep seeing:

cryptsetup: WARNING: failed to detect canonical device of overlayfs
cryptsetup: WARNING: could not determine root device from /etc/fstab

TestDisk:
![TestDisk image](http://s9.postimage.org/49vf3vhvh/Screenshot_from_2012_11_23_01_32_44.png)

GPARTED:
![GPRTED image](http://s6.postimage.org/lbaw29e4f/gparted.png)

Best Answer

Trying to summarize what you did, what you issue is, and what you intend to achieve:

  • this is a Wubi installation on Windows booting from /sda4
  • NTFS Partition /sda4 contain HP-Tools, partition /sda3 contain Windows recovery
  • NTFS Partition /sda1 was overwritten in the attempt to add a swap partition
  • NTFS Partition /sda2 may contain Windows system files or data is faulty

From this I assume that you once had only one single partition for Windows which was now split into /sda1 (swap) and /sda2. You would have to undo the partitioning to restore the primary state of your partition table.

Only if you had not written to the drive you may successfully recover the files within these partitions

Recover old partitions:

For recovery you should carefully follow the steps outlined in the Testdisk tutorial from CG-Security. This tutorial is quite elaborate but its excellent. This is why we do not copy it to here but rather reference it with a link:

Test it!

In case all went right you may be able to boot again and have access to all your files as it was before. Do not try to add a swap partition for a Wubi installation as this would mainly be needed for hibernation which should not be done with Wubi.

What if this fails?

In case parts of your files were lost you may be able to restore important private data using PhotoRec which is included in the TestDisk suite but you probably will not be able to restore system files from your OS. Then the fastest method to get back a working machine is to reinstall your operating systems with Windows first and then Ubuntu in a dual boot setup. Then a swap partition will automatically be created for you from the Ubuntu installer.