16

How I can restore files and folders. I've deleted my home folder recursively. :(

guntbert
  • 13,134

2 Answers2

9

Trying to restore files and folders may become a hard and difficult task my friend, but you can find useful answers in this question: Formatted and lost 6 years worth of photo memories.. any way to get this back?

This is what I said, and worked for me, placed here for your convenience:

You may wish to take a look at this: Recovering deleted data from deleted partition- solved

It's quite long, my personal experience when I accidentally removed the whole partition on a 500GB HDD.

*The procedure I used is documented at the very bottom, placed here for your convenience:

*IMPORTANT: Try not to use forensic recovery procedures and not to use MS based recovery tools in the first instance.***

  1. First of all you calm down. Tranquil, if you erased or removed the partition's table, the data is still there. You need to find a way to bring it back, that's it.
  2. The most you can keep the drive off new data, the best for your data. If you write new data, the older data will be replaced by the new as this starts using the clusters.
  3. If possible, try not using MS based tools, which (in my case) just wrote a few clusters in the disk which made unusable some data. MS Recovery Tools (such as Easy Data Recovery and others) tries to read the partition table but it also writes some clusters which can't be fully read in order to recover the "usable part of the data". This may harm your data replacing the original allocation clusters with blank data which allows the software to gain access to the cluster itself.
  4. Follow the instructions shown on the video documented by amzertech, which was embedded in the previous post and that clearly explains exactly what I did in order to recover my data.
  5. If you follow these instructions, I am sure you are going to succeed. Even in the worst cases (how can a different case than mine be worst?) you will succeed if you follow this easy instructions. Remember, the data will remain intact if you leave the disk intact. The most things you do to the disk, will be the most risk your data is reaching.

Anyway, this can be useful even if you deleted the whole partition (as I did then), and if you wish to run the risk to use forensic recovery procedures, I suggest you the usage of foremost, which will bring back all the data you had stored in a specific place, but WARNING: This will bring back all the stuff that were saved into these folders since the beginning of the times.

Good luck!

  • Have you also tried Testdisk/Photorec apart from Foremost? – Luis Alvarado Apr 06 '11 at 15:43
  • I haven't tested Photorec. The procedure that I talked about in my answer is Testdisk related, it did the gross of the work for me. Foremost was also useful and I started noticing about the existence of the Photorec when I gave this answer to @Lee Jarrat at http://askubuntu.com/questions/32685/formatted-and-lost-6-years-worth-of-photo-memories-any-way-to-get-this-back. – Geppettvs D'Constanzo Apr 06 '11 at 16:02
  • There is nothing dangerous on using foremost. When I have a need for file recovery on the disk on which Ubuntu is installed, I boot from a LiveCD and run foremost on it. I do not run is as root, I chmod +r /dev/sdXY, so I'm absolutely sure that the partition itself is not touched. For performance, write the data to another disk, e.g. an external HDD or 2nd internal HDD. – Lekensteyn Apr 06 '11 at 19:42
  • I agree to what @Lekensteyn says, that's why I suggested you the usage of foremost. But dropped a warning about MS based forensics recovery procedures/tools as these are which can be harmful for your data. – Geppettvs D'Constanzo Apr 06 '11 at 20:12
  • 1
    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). I needed to use Testdisk's Deeper Search and the option P (list files) to be able to write partition structure to disk. So, Testdisk has worked out even if I had mistakenly installed a new Ubuntu and swap partition. – yuric Dec 07 '13 at 17:55
  • Update: well, I had some problems with files recovered by Testdisk. Some of my folders are empty and a few files' got corrupted. Fortunately, my most important folders were not empty. Even so, I think Testdisk has made magic, once I had written my disk with a new Ubuntu installation and with a swap partition positioned at the end of the disk. – yuric Dec 22 '13 at 12:57
  • Good to know. Thank you for your feedback @YuriC – Geppettvs D'Constanzo Dec 23 '13 at 16:13
0

If you are using Ext2, then you can use Midnight-Commander's Undelete function.

But the Debian versions used to have M-C compiled without it; maybe it's different now though. So I used an old copy of Suse-8 [on another drive & which I keep for just that purpose].

So from then on [& forevermore] I shall stick to Ext2 for that reason.