How to recover data from NTFS partition that was made into a Swap partition?

I have extremely important stuff on my windows partition which during the ubuntu 10.10 installation,when it said that I should create something called swap space, I selected it to be a swap space (without even knowing what it actually meant)

The Grub2 doesn't show up so I don't get a choice to boot Ubuntu or Windows. I don't get my windows partition as a removable device in Ubuntu either. When I go to disk utility and select the sda2 (i.e.. my windows partition) and click edit partition and select HPFS/NTFS for the type and tick bootable and click OK the small processing sign keep on rotating on the bottom right of the sda2 in the chart and after about 10 to 15 minutes it gives an unknown error and thus, I am still unable to use my windows.

I am even worse than a beginner who doesn't know a thing about Ubuntu so please be patient and help me out.


Solution 1:

Don't let the panic invade you. Before trying anything, follow this steps:

Note: to open a program, just press Super to open the dash, and search for its name.

  1. Don't turn your computer on. Instead, go get a Ubuntu live-CD and boot with it.
  2. Immediately after it has booted, open a Terminal and disable the swap partition with:

    sudo swapoff -a
    

    It's very important to do that, or your Ubuntu will overwrite the contents of the partition when it gets out of memory.

  3. (Optional) If have an external disk with enough space, save a full copy of your drive on it:

    sudo apt-get install gddrescue
    cd /media/your-external-disk
    ddrescue -v /dev/sd? backup.dd state.log
    

    Be sure to replace the ? with the letter of the damaged drive.
    Run GParted if you don't know which one is it.

  4. Install testdisk with:

    sudo apt-get install testdisk
    

    and then run it with sudo testdisk.

  5. This is the program that may save your bacon!
    Then, just follow these steps very carefully.
    If you're lucky, you will be able to access your original files and restore your partition back!