I was trying to install ubuntu manually from my external hard drive(which has ubuntu installed in it) to my internal hard drive.I created the swap area using mkswap command in a wrong partition(my windows partition). The partition is not formatted but converted into a swap area.Because of this I cannot boot into my windows.Is there any way that restore the partition back to its normal state?

I found this while doing some research.But I guess that works only when the drive is formatted and when one has to recover the lost data.

Thank you.


Could you please tell which Windows partition has been selected as swap area?

I think there generally are two partitions made default by Windows 7 in most cases, one of which is bootloader. Did you select that one or the C drive one as your swap area? Did you delete the old bootloader parition?

In any case, when you boot into Ubuntu next time, see that you off the swap first (How to do that is there in the question you linked). Otherwise it will start writing data, which I don't think would turn out good.

If you just selected C drive, I think swapoff and update-grub should reset your Windows system.

sudo swapoff -a

sudo update-grub

For more details on how to turn off swap, look here: Deleting Unused Swaps Partions

  • Its not the boot loader (system reserved partition) its the one in which windows is installed.Any way I tried the method you told... it didn't work... – Sai Suman Sep 16 '12 at 19:04
  • @Avatar: In that case, I think Windows 7 option is still available in GRUB menu, but the problem is Windows wouldn't boot after that bootloader says "Starting Windows". I suggest you to turn off the swap first, and then use testdisk like jmendeth said in the question you linked. I think using cfdisk might be a good idea, - you can also try to change swap partition type using cfdisk and convert it into NTFS one, then mount it to see whether files are intact or not. Take a look here: ubuntuforums.org/archive/index.php/t-942145.html – Forbidden Overseer Sep 16 '12 at 19:20
  • wouldn't changing the partition type format the existing partition into the changed partition type? I just want to convert the swap area back into NTFS partition not format the swap area into it(NTFS partition). – Sai Suman Sep 16 '12 at 19:36
  • TBH, I am not sure about that. I was just suggesting an idea... you better not do it yet. I hope you must have turned off the swap by now. Just make the backup of that partition and restore them like it was suggested in the question you linked. I don't think there's some other way to turn off swap and revert to old state. – Forbidden Overseer Sep 16 '12 at 19:48
  • I was setting up dual boot with arch and accidentally created the swap on the Windows EFI partition. When running grub-mkconfig with os-prober it wouldn't detect windows. I thought I had messed everything up and had to start over (and re-install windows too). This answer saved me. Thanks a lot. – MiniGod Feb 27 '18 at 10:04

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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