1

This question already has an answer here:

I tried to install ubuntu to get dual OS but incidentally delete one of the windows' partition in the process...... I can't boot windows or even use the recuse tool to recovery it...

I've backed up my C drive on ubuntu and now I'm wondering if I can somehow recover that partition without having to reinstall as I don't have windows' installation CD/USB

From what I searched online it seems like what I am missing is either the recovery partition or the loader partition? (are there supposed to be 2 loader partitions?) However, I can't really find a solution that's suitable to my situation. right now all I have is a bootable ubuntu USB and I don't have a bootable windows media I'm using sony ultrabook, so there's no cd drive.

I'm just wondering if I know which partition I deleted and I can format the partition in the right form and copy the files there... will it fix my problem....?

I've attached screenshot of my current partition info pic1

pic2

marked as duplicate by Eliah Kagan, Fabby, David Foerster, muru, TheWanderer Jan 1 '17 at 14:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • you can use ntfsundelete – Chinmaya B Jul 20 '14 at 10:26
  • I did ntfsundelete /dev/sda1 and got The device /dev/sda1 doesn't exist should I create a ntfs partition with all the free space on the disk? (I don't want to do anything before I'm sure it won't override the current data) – user307370 Jul 20 '14 at 10:31
  • I didn't format anything or change any partition except deleted /dev/sda1. I believe it's alloced 271 mb when I deleted it... – user307370 Jul 20 '14 at 10:36
  • also, I didn't install ubuntu on my hard drive yet – user307370 Jul 20 '14 at 10:38
  • 4
2

Note: This answer came from the OP's original post, which was edited in. I (@KazWolfe) have moved it to Community Wiki status to actually have it in the right section. Without further ado...


Using some information found in the comments, I went to the Data Recovery wiki page, which helped solve my problem.

Anyway, what I did is the following:

sudo swapoff -a
sudo parted /dev/sda
    rescue 1 273

(The 1 came from the 1MB of free space before hitting Delete, and 273 is the current amount of free space in MB)

Parted suggested that my drive was FAT32, and I accepted this information. Upon running "check disk errors" from the Ubuntu ISO, my system worked again.

0

I am not sure, if you created/moved/extended some other partitions that now claim the space that previously was your windows partition.

If you did not do such a thing, then the good news is, that your data is still there, but the operating system does not know it.

Therefore, you may have a chance (not a guarantee) to recover your data by following this procedure:

  1. Create a new partition /dev/sda1 on the location where the windows partition should be. In your case, the best guess would be to claim all the free space shown by gparted at the beginning of your hard drive. Do not format the partition!
  2. Set the partition type to NTFS. Apparently, this cannot be done in gparted, but the following may help:

    sudo fdisk /dev/sda
    Command (m for help): t
    Partition number (1-7): 1
    Hex code (type L to list codes): 7
    Command (m for help): w
    
  3. Reboot your machine. Hopefully, the lost data on the partition will reappear.

  4. Backup your windows data!

Do not format the newly created partition! Formatting would basically tell the system to remove all information about where to find the files on the resurrected partition.

Edit:

The partition code 7 is NTFS. If the partition was FAT32, then the code would be c instead of 7. If you enter an uppercase L instead of a partition number, then fdisk will show you the list of possible codes.

  • Just a short disclaimer: All of the above is dangerous, if done wrong. – Black Jul 20 '14 at 11:01
  • I cannot emphasize enough that you should NOT simply try the above advice on a whim. It is very specific to a certain case, not necessarily the one on the OP posed, and is dangerous. Black, you have a serious obligation to put your small caviat (that you added as a comment to your own post) as an edit to the top of your answer. People could wreak some serious havoc on their systems blindly following this advice. This can ruin your only working partition if any of a series of conditions are not met. I would advise instead examining your partitions first using gparted, and then moving forward fr – physincubus Feb 2 '15 at 15:00
  • From @physincubus: I cannot emphasize enough that you should NOT simply try the above advice on a whim. It is very specific to a certain case, not necessarily the one on the OP posed, and is dangerous. People could wreak some serious havoc on their systems blindly following this advice. This can ruin your only working partition if any of a series of conditions are not met. I would advise instead examining your partitions first using gparted, and then moving forward from there, specifically by following the advice in help.ubuntu.com/community/DataRecovery – user68186 Feb 2 '15 at 15:34
  • In other words: only try this after making an image of the disk, an exact bit for bit image. Try this on that image, and keep your original disk safe. – SPRBRN Feb 2 '15 at 15:41

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