Skip to main content

How to recover deleted files on Linux



On a typical file system, deleting a file doesn't necessarily mean that it is gone for good. When a file is removed, its meta data (e.g., file name, size, time, location of data block, etc.) is gone, but actual file data is untouched inside the file system, until the location of the data is overwritten by other file data. This means that if you accidentally deleted a file, there is a chance that you can recover the file.

In this tutorial, I describe how to recover deleted files on Linux. There are several file recovery tools on Linux. Among them is PhotoRec which is an open source file recovery software licensed with GPLV v2+. PhotoRec is available on Linux, BSD, MacOS X and Windows.

PhotoRec Features

As the name implies, PhotoRec is originally designed to restore accidentally deleted digital photos. However, now it has become versatile enough to support various file formats. PhotoRec recovers lost files by checking data blocks one by one against a signature database of different file types.

  • Supported file formats: video (avi, mov, mp3, mp4, mpg), image (jpg, gif, png), audio (mp3, ogg), document (doc(x), ppt(x), xls(x), html), archive (gz, zip) etc.
  • Supported file systems: EXT2, EXT3, EXT4, HFS+, FAT, NTFS, exFAT

Besides hard disks, PhotoRec can restore files stored on CD/DVD drives, USB sticks, memory cards (CompactFlash, Memory Stick, Secure Digital/SD, SmartMedia), etc. So if you accidentally lost digital pictures stored on the memory card of a digital camera, you can use PhotoRec to undelete them.

Install PhotoRec on Linux

The official site offers PhotoRec binaries for various platforms. So you can download static PhotoRec binary for your Linux system.

For 32-bit Linux:

$ wget http://www.cgsecurity.org/testdisk-6.14.linux26.tar.bz2
$ tar xvfvj testdisk-6.14.linux26.tar.bz2

For 64-bit Linux:

$ wget http://www.cgsecurity.org/testdisk-6.14.linux26-x86_64.tar.bz2
$ tar xvfvj testdisk-6.14.linux26-x86_64.tar.bz2

The PhotoRec executable (photorec_static) is found in the extracted directory.

Recover Deleted Photos and Videos

In this tutorial, I demonstrate how to recover deleted photos and video files stored on an SD card, which were generated by Canon EOS Rebel T3i.

When you have removed a file accidentally, what's important is to NOT save any more files on the same disk drive or memory card, so that you do not overwrite the deleted file.

As soon as you discover the lost files, run PhotoRec to restore them as follows.

$ sudo photorec_static

You will be shown a list of available media. Choose the media where you have deleted files.

Next, choose the partition which contains deleted files.

Choose the file system type used for the partition. In general, you can identify the file system type from the output of mountcommand. In case of the SD card used by Canon camera, it is formatted in VFAT file system. So choose "Other".

Choose if all disk space needs to be analyzed. In this case, choose "Free", which means scanning for unallocated space only.

Choose a destination folder where restored files will be stored. Here you must choose a different partition or drive than the one being analyzed. Press "C" when a destination is chosen.

Now PhotoRec starts reading individual sectors for lost files. You will see the progress of the recovery. Depending on the size of media, it will take a couple of minutes or even longer.

After scanning is completed, the restored files will be stored in the destination folder that you configured. Note that the size of a restored file may be either the same as or larger than the original file size.

source: xmodulo.com

Popular posts from this blog

Include dbase on PHP 5.3 Centos 5.7

I want to enable dbase on PHP 5.3. And i found website that have information about it. Environment : OS : CentOS 5.7 Final Web Server : httpd-2.2.3-53 PHP : php53-5.3.3-1.el5_6.1 Programming Language : gcc Download package from php.net [root@compare] # wget http://pecl.php.net/get/dbase-5.0.1.tgz Extract package [root@compare] # tar -zxvf dbase-5.0.1.tgz Prepare the build environment for a PHP extension and compile [root@compare] # cd dbase-5.0.1 [root@compare] # phpize [root@compare] #./configure [root@compare] # make [root@compare] # make install copy dbase.so to http modules [root@compare] # cp /root/php/dbase-5.0.1/modules/dbase.so /usr/lib64/httpd/modules/ Message error if dbase.so not compatible or not installed correctly [Wed Oct 26 20:15:28 2011] [error] [client 192.168.1.254] PHP Fatal error: Call to undefined function dbase_open() in /var/www/html/compare/impdbf.php on line 19 That's all Source : http://www.myee.web.id/index.php/howto.html

Free Stuff

I have free stuff that can i share with you. The free stuff is free magazine, free domain, free hosting, free rapidshare link generator and free money. 1. Free Magazine. You can get free magazine for you to read. There are many topics that can you choose. These are the topics that can you choose : Agri c ulture Automotive Biotechnology & Pharmaceuticals Computers Construction Education Engineering Executive & Management Finance Food & Beverage Government Healthcare Human Re sources Industrial & Manufacturing Internet Information Technology IT - Data Management IT - Security IT - Software & Development IT - Storage Insurance Mechanical / Machine Meetings & Travel Multimedia Network / Communications Purchasing & Procurement Retail Sales & Marketing Small & Medium Business Telecom & Wireless Trade/Professional Services Transportation & Logistics Utility & Energy Many topics

Rapidshare Premium Link Generator

Rapidshare Premium LINK Generator . Rapidshare.com is one of the biggest site that allow you to upload and share files with vary sizes. From rapidshare, you also can download files that another person upload the re. There are 2 kinds of user can download from rapidshare. First, free user, this user have limit features from rapidshare. Limit bandwidth, limit connection, etc. Second, premium user. Premium user have many features that free user doesn't have. If you want to be a premium user, you have to buy it from the web. You can use this link to buy premium account or from reseller that near you. But if you have not enough money to buy it, you can use Rapidshare Premium Link Generator . This is a website that give free service for anyone to generate rapidshare link from free to premium, so anyone can download with premium feature. <br><br>I