Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I have migrated from Windows 7 to Ubuntu just yesterday. Windows 7 was in my C: drive. I did not realise that if I wipe Windows 7 and install Ubuntu, Ubuntu would be installed in the C: drive only. So I didn't make any backups, and I deleted Windows and installed Ubuntu. But, Ubuntu has formatted my hard drive and I have lost all my important data!

How can I recover my data now?

share|improve this question
    
I am just a beginner in UBUNTU. will you please tell me step by step process. my hdd is SATA 500 GB, OS- ubuntu 12.10 and i have a live USB of ubuntu 12.10 –  nurul islam Jan 23 '13 at 6:10
    
the C drive is completely irrelevant to ubuntu. Drive labelling is actually just an abstraction given by windows. In actual fact the C drive is just a part of your hard drive called a partition. Windows will always label the partition it is installed to C. When you installed ubuntu it didn't just use this partition, it used the entire drive, because that is what you told it to do. I'm afraid I find windows use of the name "drive" rather annoying, as it confuses users into thinking a partition is a "drive". –  handuel Apr 4 '13 at 17:00
add comment

marked as duplicate by psusi, aquaherd, Seth, Mateo, Eric Carvalho May 19 '13 at 0:24

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.

3 Answers

up vote 4 down vote accepted

For recovering accidentally overwritten partitions with TestDisk Install banshee please follow these prcoedures:

  • Stop using the drive!
  • Boot Ubuntu live session ("Try Out Ubuntu") from a CD or USB-drive
  • Install Testdisk to the live session via the Software Center
  • follow this concise guide for recovery: TestDisk Step by Step

Optionally (but highly advisable) and if we had an external drive big enough to hold all of the faulty drive we can make a backup to recover data or partitions from an image. Make this image with the following command in a terminal:

sudo dd if=/dev/sdX of=/path/to/external_drive/backup.img

Replace sdX with the drive to recover. Since dd is an advanced and potentially harmful tool take extra care to not accidentally overwrite any drive you may still need.

In case you are unable to recover your partitions you may be able to recover single files by running PhotoRec wich comes with the TestDisk suite.

Just to have mentioned it: there are other "forensic" tools to help you recover lost partitions or files. See How to recover deleted files?.

share|improve this answer
    
in my hdd i had around 40 GB of impotent data which i want to recover. Now i have an external usb drive (pen drive) of 8 GB, is it possible to copy the recovered data by PhotoRec in multiple session (pause and resume) on pendrive and transfer it to another pc or i have to run PhotoRec too many time to copy data. –  nurul islam Jan 24 '13 at 5:09
    
@nurulislam: it is possible to recover files by a single type only but you may have more than 8 GB of files of a single type. It is therefore strongly advisable to have an external strorage medium at hand which is big enough to hold all of the recovered files. BTW PhotoRec will not recover paths or filenames. –  Takkat Jan 24 '13 at 9:20
add comment

(For those who have the opposite problem: you think you've formatted the Ubuntu partition).

  • try booting using the bootable Ubuntu CD/DVD or USB drive and start partitionmanager/gparted in it.

1) BAD SCENARIO It either should display that the partition is still using Ubuntu filesystem (typically ext4) or not. If you've formatted the Ubuntu partition (ext4) in Windows to the NTFS filesystem, than the data are very likely gone. :-(((

2) Good scenario If the partition is there and you simply cannot boot to the Ubuntu, try this guide to restore the (grub) boot chain:

https://help.ubuntu.com/community/Boot-Repair

share|improve this answer
add comment

You can use testdisk application to recover data from device .For downloading use

sudo apt-get install testdisk

share|improve this answer
1  
Do not install testdisk in the Ubuntu system that has been installed on the hard disk! Installing software in the Ubuntu system that has overwritten Windows will destroy even more data and make it almost impossible to recover anything. –  Eliah Kagan Jan 22 '13 at 6:09
    
use testdisk from a portable ubuntu (like external hdd boot) . –  ubuntu_geek Jan 22 '13 at 6:30
1  
I highly recommend adding that information to your answer. (Also note that testdisk will install fine in a live environment, so a live CD/DVD or live USB works OK for this purpose.) –  Eliah Kagan Jan 22 '13 at 6:47
    
I am just a beginner in UBUNTU. will you please tell me step by step process. my hdd is SATA 500 GB, OS- ubuntu 12.10 and i have a live USB of ubuntu 12.10 –  nurul islam Jan 23 '13 at 6:11
    
thank all of u. ihave recovered the partition and installed ubuntu12.10 freshly –  nurul islam Feb 14 '13 at 4:07
add comment

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