This question already has an answer here:

I am very new to ubuntu. During ubuntu installtion, I choose an option that allow ubuntu (12.10) to replace my window 7 without knowing that it will formate and repartition my hard disk. Then, all my important files are gone.

Could you please tell me how can I get my files back? or if possible, Could i recover all partition back?

Your help will be appreciated.

marked as duplicate by Luis Alvarado May 26 '14 at 14:49

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
    Now that the disk is overwritten, it is unlikely you will be able to salvage any files, and even more unlikely that you will be able to get everything you need. Do you, by any change, have a backup? – hexafraction Jan 5 '13 at 13:16
  • No I don't have a backup. Now the hard disk has been formated to ubuntu file system. I am so hopeless. – Bunmao Jan 5 '13 at 13:22
  • Unfortunately, if the data has been overwritten by Ubuntu system files, it is next to impossible to recover it. There are ways, however they often fail and require state-of-the-art lab equipment. – hexafraction Jan 5 '13 at 13:39
  • Not helping, but very curious. What did you miss about the warning in the installation screen? – gertvdijk Jan 5 '13 at 14:01

Oh man I feel sorry for you, however all is not lost. the best thing you can do is STOP using the computer switch it off. Lookup a local data recovery specialist tell them everything you did, With a bit of luck they can recover a lot of the data you had.

The only data you will lost is what has been overwritten, I don’t know how much a freshly installed Ubuntu takes up but as long as you didn’t choose to Encrypt the Ubuntu install and overwrite unused space then there will be good data still sat on the disk.

If you cannot afford data recovery as it usually is quite expensive I would do the following.

STEP 1 (Optional but recommended)

Take a byte for byte image of the drive using a live CD such as TRK

you can use dd to do this

I'm asuming you have one hardrive and its /dev/sda

The next command is going to take an exact copy of your hard drive so you will need somewhere with enough space to fit this copy. If your hard drive is 500GB you need 500GB of space

dd if=/dev/sda of=/mnt/myexternaldrive/drive.img

Step 2

run photorec to recover files.

Note that this will scan your hdd or image for common file types it does not recover file names.

photorec /mnt/myexternaldrive/drive.img

follow the onscreen instructions it will ask you for a location to restore files to make sure it has plenty of room to do this. You can also fine tune it to just recover say your pictures or your documents.

Like I say professional data recovery is the best route but I have recovered a lot of data using the above method.

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