Software:PhotoRec

From HandWiki
Short description: Open source data recovery software
PhotoRec
PhotoRec Logo.svg
Testdisk-ubuntu.png
Demonstration of PhotoRec running in Linux
Developer(s)Christophe Grenier
Initial releaseApril 30, 2002; 22 years ago (2002-04-30)
Stable release
7.1 / July 7, 2019; 5 years ago (2019-07-07)
Repositorygit.cgsecurity.org/cgit/testdisk/
Written inC (nCurses)
Operating systemCross-platform
PlatformCLI
TypeData recovery
LicenseGNU GPL v2+ (free software)
Websitewww.cgsecurity.org/wiki/PhotoRec

PhotoRec is a free and open-source utility software for data recovery with text-based user interface using data carving techniques, designed to recover lost files from various digital camera memory, hard disk and CD-ROM. It can recover the files with more than 480 file extensions (about 300 file families). [1] It is also possible to add custom file signature to detect less known files.[2]

PhotoRec does not attempt to write to the damaged media the user is about to recover from. Recovered files are instead written to the directory from which PhotoRec is run, any other directory may be chosen. It can be used for data recovery or in a digital forensics context.[3][4][5] [6] [7] PhotoRec is shipped with TestDisk.[8]

Functionality

FAT, NTFS, ext2/ext3/ext4 file systems store files in data blocks (also called data clusters under Windows). The cluster or block size remains at a constant number of sectors after being initialized during the formatting of the filesystem. In general, most operating systems try to store the data in a contiguous way so as to minimize data fragmentation. The seek time of mechanical drives is significant for writing and reading data to/from a hard disk, so that is why it is important to keep the fragmentation to a minimum level.

When a file is deleted, the meta-information about this file (filename, date/time, size, location of the first data block/cluster, etc.) is lost; e.g., in an ext3/ext4 filesystem, the names of deleted files are still present, but the location of the first data block is removed. This means the data is still present on the filesystem, but only until some or all of it is overwritten by new file data.

To recover these "lost" files, PhotoRec first tries to find the data block (or cluster) size. If the filesystem is not corrupted, this value can be read from the superblock (ext2/ext3/ext4) or volume boot record (FAT, NTFS). Otherwise, PhotoRec reads the media, sector by sector, searching for the first ten files, from which it calculates the block/cluster size from their locations. Once this block size is known, PhotoRec reads the media block by block (or cluster by cluster). Each block is checked against a signature database; which comes with the program and has been growing in the type of files it can recover ever since PhotoRec's first version came out. It is a common data recovery method called file carving.

For example, PhotoRec identifies a JPEG file when a block begins with:

  • Start Of Image + APP0: 0xff, 0xd8, 0xff, 0xe0
  • Start Of Image + APP1: 0xff, 0xd8, 0xff, 0xe1
  • or Start Of Image + Comment: 0xff, 0xd8, 0xff, 0xfe

If PhotoRec has already started to recover a file, it stops its recovery, checks the consistency of the file when possible and starts to save the new file (which it determined from the signature it found).

If the data is not fragmented, the recovered file should be identical to (or possibly larger than) the original file in size. In some cases, PhotoRec can learn the original file size from the file header, so the recovered file is truncated to the correct size. If, however, the recovered file ends up being smaller than its header specifies, it is discarded. Some files, such as *.MP3 types, are data streams. In this case, PhotoRec parses the recovered data, then stops the recovery when the stream ends.

When a file is recovered successfully, PhotoRec checks the previous data blocks to see whether a file signature was found but the file was not able to be successfully recovered (i.e., the file was too small), and it tries again. This way, some fragmented files can be successfully recovered.[9]

Notable, PhotoRec does no restore original filenames but one can e.g. rename the JPG files with pictures using exiftool: https://www.cgsecurity.org/testdisk_doc/after_using_photorec.html#renaming-files-using-exiftool

PhotoRec is superior to Scalpel and provides technically more correct files. In a discussion at https://github.com/sleuthkit/scalpel/issues/35 came ou that "Scalpel does not repair broken headers/EOF markers like PhotoRec in Autopsy. If you use a hex editor to manually repair the recovered files, then you will end up with the same images/files." Scalpel provides more broken JPG files where PhotoRec did the correct task on ext4 filesystem.

PhotoRec (Testdisk) is bundled in Autopsy and WondershareRecoverIt packages (paid).

Compatibility

PhotoRec is compatible with:[10]

Distribution

PhotoRec and TestDisk are shipped together. They can be downloaded from CGSecurity website. These utilities can be found on various Linux Live CDs:

They are also packaged for numerous *nix (mostly Linux based) distributions:

See also

References

  1. "File Formats Recovered by PhotoRec". April 2015. http://www.cgsecurity.org/wiki/File_Formats_Recovered_By_PhotoRec. 
  2. "Add your own extension to PhotoRec". 18 May 2016. https://www.cgsecurity.org/wiki/Add_your_own_extension_to_PhotoRec. 
  3. Jack Wiles, Kevin Cardwell, Anthony Reyes (2007). The best damn cybercrime and digital forensics book period, p. 220. Syngress Publishing Inc. ISBN:978-1-59749-228-7.
  4. Cameron H. Malin, Eoghan Casey, James M. Aquilina (2008). Malware Forensics: Investigating and Analyzing Malicious Code, p. xxviii. Syngress Publishing Inc. ISBN:978-1-59749-268-3.
  5. Nathan Clarke (2010), Computer Forensics: A Pocket Guide, p. 67. IT Governance Publishing. ISBN:978-1-84928-039-6.
  6. NIST Test Results for Graphic File Carving Tool: PhotoRec v7.0-WIP[yes|permanent dead link|dead link}}].
  7. NIST Test Results for Video File Carving Tool: PhotoRec v7.0-WIP .
  8. Scott Mueller, Brian Knittel (2008). Upgrading and Repairing Microsoft Windows, Second Edition, page 685. Pearson Education Inc. ISBN:978-0-7897-3695-6.
  9. How PhotoRec works (Description from the author website).
  10. "PhotoRec - CGSecurity". http://www.cgsecurity.org/wiki/PhotoRec. Retrieved March 1, 2013. 
  11. "GParted -- Live CD/USB/PXE/HD". http://gparted.sourceforge.net/livecd.php. Retrieved March 1, 2013. 
  12. "programs – Parted Magic". http://partedmagic.com/doku.php?id=programs#.UTDEoT4-jbU. Retrieved March 1, 2013. 
  13. "Recover file with PhotoRec". http://wiki.slaxlfi.fr/doku.php?id=recuperation:recuperer_des_fichiers_avec_photorec. Retrieved March 1, 2013. 
  14. "System-tools - SystemRescueCd". http://www.sysresccd.org/System-tools. Retrieved March 1, 2013. 
  15. "Software Ubuntu Rescue Remix". http://ubuntu-rescue-remix.org/Software. Retrieved March 1, 2013. 
  16. "TestDisk on ALT Linux". http://alt.linux.kiev.ua/srpm/testdisk/get. 
  17. ArchLinux Extra Repository
  18. TestDisk on Debian
  19. TestDisk in Fedora
  20. "RepoView: "Fedora EPEL 6 - x86_64"". http://dl.fedoraproject.org/pub/epel/6/x86_64/repoview/testdisk.html. Retrieved 27 July 2013. 
  21. TestDisk in FreeBSD ports
  22. TestDisk in OpenBSD ports
  23. TestDisk in Gentoo
  24. TestDisk in Gentoo Portage
  25. TestDisk in Source Mage
  26. "Delete Hui Photo Waapas Kese Laaye || डिलीट हुई फ़ोटो वापस कैसे लाए 2 मिनट में ?". https://www.technicalmamas.com/2019/06/how-to-get-deleted-photos-back.html. 

External links