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?

10

4 Answers 4

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'.

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

1
  • 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? Nov 29, 2021 at 4: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.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .