Undelete Linux Files from an ext2 File System


A few days ago, I run into big trouble as I deleted accidentally the whole home directory of an employee.
I knew that there is no trash can in Linux like in Windows.
So the work of 6 months seemed to be destroyed.
While doing a long research on the web, I found some ways and tools to recover deleted files on an ext2 Linux file system.
I tested all the tools on a second machine, while deleting files and trying to recover them, but only with more or less random success.
Late at night I found a tool, which seemed to be the right one to help me.
Sebastian Hetze from the company Lunetix developed a tool called: undelete.
While testing this tool, I got the best results, specially for text files.
Using the undelete program, I got 99% of the files back.
Here are the steps, I did to recover the files.

Steps to undelete files from an ext2 file system:

  1. preparations
  2. download the undelete tool on another partition or machine
  3. download the e2fsprogs package on another partition or machine (needed to re-compile the undelete tool)
  4. follow the install and compile instructions for the e2fsprogs package and the undelete tool
  5. for better results, the undelete tool should be re-compiled with the current kernel
  6. read the README file of the undelete tool
  7. open a root console
  8. copy the undelete binary to: /usr/bin
  9. create a new directory e.g. mkdir dump
  10. change to the new directory
  11. run the undelete tool on the affected partition, e.g. machine:~/dump # undelete -d /dev/hdc3 -a 10
  12. pray, or if you are faithless: stay cool
  13. follow the instructions given by the tool
  14. be happy


Helpful links about this topic

Linux Ext2fs Undeletion mini-HOWTO
Disc recovery tools for EXT2FS
Recovering Deleted Files with mc
Löschen und Restaurieren von Dateien

Holger Rath, 20. November 2001