3

When I booted and installed Ubuntu, I gave all of the hard disk space to Ubuntu -- my whole hard disk was formatted.

I had plenty of pictures, videos and music on my Local Disk [D] drive and I don't want to lose this media.

Now I have only one 500GB partition.

How do I recover my files?

Milos
  • 31
  • it is difficult but you may get some of the data via format recovery tools – Tachyons Mar 17 '12 at 10:49
  • http://askubuntu.com/questions/33800/how-to-recover-deleted-files-and-folders – Tachyons Mar 17 '12 at 10:51
  • http://askubuntu.com/questions/3883/how-to-recover-deleted-files – Tachyons Mar 17 '12 at 10:51
  • http://www.recovermyfiles.com/ i am using this tool but it is for windows only – Tachyons Mar 17 '12 at 10:55
  • Hmm. Thanks for help. i will try to install windows again, but I'm afraid all of my data will be lost forever then since its a install of new os, windows. I'd rather die now than loosing my data :(

    I should have installed wubi :S

    – Milos Mar 17 '12 at 10:58
  • then try testdisk
    sudo apt-get install testdisk
    – Tachyons Mar 17 '12 at 11:01
  • No you didn't understood me well. i installed ubuntu with booting and formated all partitions ACCIDENTLY and then installed ubuntu on only 1 partition. can i get thoose partitions back? – Milos Mar 17 '12 at 11:02
  • yeah you may can recover at least some of your data – Tachyons Mar 17 '12 at 11:13
  • ok help me HOW to recover AT LEAST pictures everything else (game servers, programs, tutorials, games) can download again :)

    God bless you :)

    – Milos Mar 17 '12 at 15:24
  • use forensic tools like "photorec,testdisk,foremost,seluthkit,extcarve" to salvage some data out of the disk. – lakshmipathi Mar 18 '12 at 09:10

4 Answers4

4

DO NOT WRITE NEW DATA TO THE DRIVE!

All or most of your old data is still there, it's just the partition table that has been replaced. However, any new data may end up overwriting the old, so the first thing you should do is unmount the drive to make sure nothing can be written to it.

If the data is important to you, your best bet is to contact a professional. You may be able to recover it by yourself, but doing so is risky at best.

If you do try it yourself, there are numerous tools available. One way is to boot into a live CD and use GParted to attempt to recover the deleted partition table. First choose the drive you wish to perform the data recovery on, then go to 'Device > Attempt Data Rescue'.

bessman
  • 7,425
1
  1. ubuntu rescue remix

    it is livecd for recoveringdata enter image description here

  2. testdisk

TestDisk is powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table). Partition table recovery using TestDisk is really easy.

TestDisk can

Fix partition table, recover deleted partition
Recover FAT32 boot sector from its backup
Rebuild FAT12/FAT16/FAT32 boot sector
Fix FAT tables
Rebuild NTFS boot sector
Recover NTFS boot sector from its backup
Fix MFT using MFT mirror
Locate ext2/ext3/ext4 Backup SuperBlock
Undelete files from FAT, exFAT, NTFS and ext2 filesystem
Copy files from deleted FAT, exFAT, NTFS and ext2/ext3/ext4 partitions. 

Installation

sudo apt-get install testdisk 

Links

Tachyons
  • 17,281
  • Would you mind cleaning up the comments under the question? Are you able to transfer all relevant guidance into your answer so that the comments can be deleted? – mickmackusa Nov 29 '21 at 04:11
1

You can also try photorec. I've used it in the past and have had great success with it. You may have to install it from apt-get or synaptic though.

Fortunately, you're given the option of what types of files you wish to recover and for the most part, it really does a good job. The only negative complaint I have about it is that it takes again as much space as the files you're trying to recover and stores the recovered files in several smaller folders -without- their original names. So, let's say for instance, you're recovering all your .gif files, you'll have to look at each file separately, to identify it. Then of course, you can cut 'n' paste to where ever you wish to keep 'em.

Another 'negative' as I can see it, is that it also uses as much space for recovery as the original files sizes, so if you're hurting for available HD space, it's gonna be a bit dicey at best. But with that said, I've successfully recovered my .avi files, .gif, .jpg, .png, text documents, etc. However, if you've reformatted your HD, you may still be out of luck.

Another option is in using Parted Magic and is bootable from a CD rom or USB stick. It too, has a data recovery mode but I've not used it so far. However, if that works like everything else included on the disk, it can be a life saver for recovering files from a trashed OS. I'm currently in a situation where I had a Linux upgrade fail and thanks to some spare HD space on other HD's, I've been able to recover and transfer all my critical files to them, so I'm left with a completely clean HD to work with. When he new OS is set up and operating correctly, I'll just transfer my stuff back to it.

PartMagic will work for several different OS's and I think everyone who owns a computer should have a copy of it, since it's a free program. Just take the time to explore it fully once you have a copy so that you'll know what it's capable of doing for you. It really is, in my opinion, an outstanding compilation of software.

Good luck with your recovery.

Cubby
  • 11
0

I had the same problem. But Testdisk was able to restore a partition I've formatted after choosing a clean install in Ubuntu 13.10 installation wizard. I've forgotten that Ubuntu wouldn't use the partition that I used to have Ubuntu 13.04 installed to make a clean install... it uses the whole HD (I had a second data partition that I didn't want to format).

The most up voted answer here helped me: How to recover Deleted Files and Folders?

This answer recommends this tutorial: http://www.youtube.com/watch?v=EncqYP1ijFg&feature=player_embedded

But, differently from the links above, I needed to use Testdisk's Deeper Search (it takes a long time) and the option P (list files) to be able to write partition structure to disk. I've tried firstly without this P option and it hasn't worked out.

After writing the partition structure to disk, quitting Testdisk and rebooting, I've got my partition exactly as it used to be before.

It's good to say that my HD was plugged in another PC using a SATA to USB adapter, but I could have booted using a Ubuntu USB stick to be able to do the same. (You'd better not to use your mistakenly installed Ubuntu to run Testdisk.)

And you'd better not to add any new files to your disk before recovering the lost partition, or you may lose your files forever.

So, Testdisk has worked out even if I had mistakenly installed a new Ubuntu and swap partition.

yuric
  • 322