Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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](


share|improve this question
Hi, welcome back! Why don't you try recovering the boot partition using "testdisk". It's in the Ubuntu repositories, and you can install it while running from the Live USB, just like Boot Repair. It's a text-based tool, but should be fairly easy to follow. Run it with `sudo testdisk, then proceed according to the screenshots. – mikewhatever Nov 22 '12 at 20:47
@mikewhatever I have been reading and reading about partitions but I'm having a hard time deciding what my settings should be (especially the partition type--which directory to mount on, name of the type (XENIX? OPUS? what?)). I want to have a large swap partition for Linux because it's slow, and I want to shrink my Windows partition in favor of Linux. If I attach a screenshot from TestDisk, could you please help me decide what my partition settings should be? Thank you in advance. =( – QuietThud Nov 23 '12 at 3:16
@mikewhatever P.S. All my partitions are currently "deleted". I'm assuming I want to have two main partitions, Win and Lin? Or put Lin on logic? Is there a difference in efficiency? What about boot partitions? I see Win has a separate boot, but Lin does not? Sorry I'm asking so many question, I know close to nothing about hardware and it's proving unreasonably difficult for me to acclimate to. Thanks again. – QuietThud Nov 23 '12 at 3:49
In case you were installing a Linux distro to dual boot with Windows, two main partitions would roughly be the layout. It makes no difference performance wise if the partition is primary or logical. A boot partition is not a requirement, and most home installations won't need it. A large swap partition won't make things faster, and if you wish to shrink another partition, I'd suggest using Gparted. – mikewhatever Nov 23 '12 at 4:31
@mikewhatever I was under the impression that a swap partition augments RAM. It's not speed per se that is the problem, but the fact that Mathematica won't run on Linux even though it runs fine on windows. – QuietThud Nov 24 '12 at 2:43

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.

share|improve this answer
Thank you very much for your detailed response. I am still having trouble deciding what "type" my partitions should be: for example, should the FAT32 partition be FAT16 >32 54 OnTrack or FAT32 63 Unixware, HURD or FAT32 LBA 64 Newtware 286 or something else? And how do I know for the rest? Also, both FAT32 and SDA1 need to be primary because they contain boot files, if I understand correctly? – QuietThud Nov 24 '12 at 2:04
Are those the options you get when trying to recover the Windows boot partition (/dev/sda1)? Wasn't it an NTFS partition? How did it become a FAT32 one? – mikewhatever Nov 24 '12 at 7:45
@mikewhatever As you can see, TestDisk says all of my partitions are currently "Deleted", and it seems I'll have to re-assign all of them. When I enter the "Change type" menu, I am asked to choose from a sizeable list; I mentioned the few items that sounded relevant to FAT32 as an example. Takkat is probably correct in that I would have to know what type the partitions were originally. – QuietThud Nov 24 '12 at 9:08
@Takkat I don't know why anything would be encrypted! This adventure has been less than exciting, my excellent companions notwithstanding. If I re-install Ubuntu alone, new partitions will be assigned, that is correct? I think I'll do that. I still feel the need for a Lin swap partition because heavy software often maxes out my virtual memory, and I have a plentiful hd. Hibernation would also be great. I'm not yet discouraged! – QuietThud Nov 24 '12 at 9:23
@mikewhatever I was misreading TestDisk, it's actually telling me the partitions are on Disk D, not that they're deleted. But they're ALL listed as Primary, with a duplicate of SDA1. – QuietThud Nov 24 '12 at 9:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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