Linux file recovery

June 21, 2007 |

If you’re like me, you must’ve at some point deleted a file or directory that you immediately regretted after. On Windows, it’s easy to recover…just go to recycle bin and restore but on Linux, how do you do it? Specially if you delete something on command line. Some distros of Linux has recycle bin such as Ubuntu which you can restore but for the majority, the deleted files seem to disappear forever and without any trace that it ever existed.

In this article, I’ve put together list of techniques and tools that can do file/directory recovery on Linux platform. But before I start listing the tools, a few common sense techniques which can make it a bit harder to delete files on your system. For example, change rm to alias=’rm -i’. This way, every time you delete a file, the system will ask if you’re sure. Second thing is simply to do backups. If you don’t have tape, use a utility like rsync to copy the important directories and files to another system or partition. You can set a crontab to do this daily or even hourly. Makes restoring so much easier in case you delete something by mistake.

  1. Recover - automates some steps as described in the Ext2fs-Undeletion-howto in order to recover a lost file. This utility will greatly increase your file recover rate. People who do not know how to undelete a file are encouraged to use this utility.
  2. athena-delete - was written at Project Athena in response to the problem which many novice UNIX users have with accidentally deleting files they didn’t want to delete.
  3. unrm - a small shell utility which can, under some circumstances, recover almost 99% of your erased data (similar to DOS’s undelete). Read carefully the FAQ file and preferably the Linux Ext2fs Undeletion Mini-HOWTO before using it.
  4. gET iT i sAY - a file recovery tool for Ext2/Ext3 filesystems. Once installed, current files and newly created files from /root and /home are recovered. It allows users to recover all deleted files, recover files owned by a specific user, dump data from old file locations, and recover files of a specific type, such as text or MP3. A forensic analyzer is also provided to assist users during recovery.
  5. e2undel - an interactive console tool that recovers the data of deleted files on an ext2 file system under Linux. A library that allows you to recover deleted files by name is included. e2undel does not manipulate any internal ext2 structures, and it does not require any additional tools. It should be useable without knowledge of the ext2 internal.
  6. anyfs-tools - allows you to recover and convert filesystems while using minimal extra disk space. Unlike other recovery tools, anyfs-tools doesn’t copy all the files found on other disks (or partitions), but only saves information about the location of the file blocks to an external inode table. After recovery, a user may mount the damaged filesystem with anyfs and the external inode table and then interact with all recovered files with any program.
  7. rfs - a shell script for creating and updating a local spare system disk. The main goal is to recover a working system after a crash quickly. In this case, “quickly” means the time it takes to reboot the machine. rfs stands for “replication of filesystems”. Like rsyncbackup, rfs is built on top of rsync.
  8. e2retrieve - an Ext2 data recovery tool that works on truncated or partial filesystems. It is very useful to retrieve data when a disk from an LVM crashes. It does not repair the filesystem but extracts and copies most of the data it can from raw Ext2 data given to it.
  9. findfile - a collection of tools for recovering files from filesystems with corrupted directories, allocation tables, etc. This can be useful when the partition table (or more) of a hard disk is corrupted, or when you have a memory card of a digital camera which is corrupted.
  10. TestDisk - a tool to check and undelete partitions. It works with the following partitions: FAT12, FAT16, FAT32, Linux, Linux swap (version 1 and 2), NTFS (Windows NT/W2K/2003), BeFS (BeOS), UFS (BSD), JFS, XFS, and Netware.

Some of these tools are old but can still be useful. If we missed something, please let us know about it.



Comments

8 Comments so far

  1. Dankoozy on June 21, 2007 4:10 pm

    Don’t forget a utility called ‘foremost’. I used it for recovering stuff off microdrives and CF cards. First I make an image of the thing onto the hard disc, then I run foremost on that image which recovers the files. Its detection is based on the headers of certain file formats, though it will work on any filesystem the types of files it will recover is slightly limited.

    http://foremost.sourceforge.net/

  2. info on June 21, 2007 4:27 pm

    Nice. We’ll add it to the list.

    Thanks.

  3. Linux Recovery on August 3, 2007 12:46 am

    you can recover your linux data from

    http://www.datarecoverylinux.com

  4. Tenzin yangzom on August 11, 2007 6:31 am

    For physical crash Hard-disk please check the www.hdrconline.com. They are having good tools for platter exchange and read write exchange tools.
    Tenzin

  5. Ubuntu Index - All things Ubuntu » Blog Archive » 101 Ubuntu Tips, Tricks and Tutorials on December 11, 2007 9:54 am

    […] also has great article on Linux file recovery. Share and Enjoy: These icons link to social bookmarking sites where readers can share and […]

  6. onorua.in.ua » Утилиты восстановления данных в Linux on April 12, 2008 8:30 am

    […] Оригинал статьи […]

  7. Z! - Zeitgeist, Entwicklung, Technik - der Technik Podcast on April 22, 2008 11:07 pm

    Z! - Episode 116: Falsche Flatrates…

    Es gibt eine Eigenheit, die viele Menschen teilen. Wenn man etwas zum ersten mal aus einer zuverlässigen Quelle hört, glaubt man es, ohne es zu hinterfragen. Man wird diese Quelle sogar - wider besseren Wissens - anderen gegenüber vertei…

  8. picture-deleter on June 24, 2008 1:45 pm

    thank you for the link to foremost.
    on my ubuntu linux:
    - sudo apt-get install foremost
    - foremost -vi -o

    and after 2 minutes my deleted pictures were in

Name

Email

Website

Speak your mind

  • Categories

  • Sponsors