Data recovery with PhotoRec: a complete guide in Spanish

  • PhotoRec recovers files from a multitude of systems and devices by working at a low level on the data.
  • The tool is free, open source and cross-platform, although its interface is text-based.
  • Its effectiveness depends on the physical state of the medium and on the fact that the data has not been overwritten.
  • Complementing it with TestDisk and other graphical alternatives covers almost any data loss scenario.

Data Recovery with PhotoRec

If you've accidentally deleted photos, documents, or videos and are looking for a way to recover your files, PhotoRec is one of the most powerful free tools you can use. It doesn't have a fancy interface, but it doesn't need one: it gets straight to the point and can retrieve data from hard drives, USB drives, SD cards, and even RAM images in many cases where you thought everything was lost.

In the following lines, you'll find a comprehensive guide to understanding what PhotoRec is, how it works internally , the situations in which it can be a lifesaver, how to use it step-by-step on Windows and Linux, its limitations, when it won't be useful, and what alternatives exist when you need something simpler or with a graphical interface. Everything is explained in standard Spanish (from Spain), with examples and no unnecessary technical jargon, but the more technical aspects are also covered if you'd like to delve deeper.

What is PhotoRec and what exactly is it used for?

PhotoRec is a free, open-source, and cross-platform data recovery program designed to rescue lost files from all types of storage media. Although its name refers to photos, it actually specializes in recovering a huge variety of formats: images, videos, office documents, compressed files, executables, and much more.

Unlike other commercial solutions, PhotoRec doesn't focus on the file system, but rather on the data itself recorded on the disk . This means it can work even when the partition is severely damaged, the partition table is corrupted, or the disk has been formatted. As long as the physical sectors remain readable and haven't been overwritten, there's a real chance of recovering data.

The project is distributed under the GNU GPL v2+ license , which allows you to use it for free, study its code, adapt it, and improve it. PhotoRec is typically distributed alongside TestDisk, another utility from the same author designed to recover partitions and make bootable disks that have stopped booting . It's common practice to download the combined TestDisk & PhotoRec package and have both tools readily available.

To protect your data, PhotoRec works in read-only mode on the source disk or memory . This minimizes the risk of the recovery process itself worsening the situation, which is crucial when you're at your limit and every sector counts.

Operating systems compatible with PhotoRec

One of the great advantages of this utility is that it works on virtually any modern operating system . It's not limited to a specific environment, so you can use it on almost any machine you have nearby.

Officially, PhotoRec can be run on:

  • DOS and Windows 9x
  • Windows NT 4, 2000, XP, 2003 and later versions such as Windows 7, 8, 10 and 11
  • Linux (with kernel 2.6.18 or higher, both x86 and 64-bit)
  • FreeBSD, NetBSD and OpenBSD
  • Sun Solaris
  • MacOS (both in older architectures like Intel, and even PowerPC in earlier versions)

Furthermore, the source code can be compiled on virtually any Unix-like system , and there are also specific builds for certain ARM-based NAS devices, such as some Synology, QNAP, and Seagate BlackArmor models. If you work with servers or network storage devices, having PhotoRec available directly on the NAS is a real peace of mind.

File systems and media types it supports

One of the keys to PhotoRec's success is that it almost completely ignores the logical structure of the file system . Instead of relying on partition information, it scans the device at a low level and looks for file signatures directly in the data blocks.

Thanks to this approach, you can recover information from formatted media or severely damaged file systems, provided the surface is readable. Systems it works particularly well with include:

  • FAT (FAT12, FAT16, FAT32)
  • NTFS
  • exFAT
  • ext2, ext3 and ext4
  • HFS + (classic in older macOS versions)

In the case of ReiserFS, this system incorporates very specific optimizations in how it saves file endings and small files , even storing some of them within the tree structure itself. This type of organization prevents PhotoRec from handling it correctly, making it ineffective with ReiserFS.

Regarding the type of devices, PhotoRec is capable of working with a huge variety of media, as long as the system sees it as a block device or as an image:

  • Mechanical hard drives (HDD) and SSD
  • optical drives such as CDs and DVDs
  • Memory cards (CompactFlash, SD, microSD, Memory Stick, SmartMedia, MMC, Microdrive...)
  • USB flash drives and USB drives
  • Raw images of disks or partitions
  • EnCase E01/EWF Forensic Imaging
  • Portable devices such as some iPod and digital cameras from Canon, Nikon, Sony, Olympus, Casio, HP, Praktica and other manufacturers

In forensic environments, many professionals use it in combination with disk images, as it allows working on a copy instead of the original , something almost mandatory if evidence is to be preserved.

File formats that PhotoRec can recover

PhotoRec works by locating specific signatures for each file type on the disk blocks. When it detects a known header, it assumes that a file of a specific format begins there and attempts to reconstruct it completely.

The program's database recognizes over 100 different file format families , which in practice translates to more than 180 file extensions . Over the years, it has been expanded to cover an increasing number of real-world scenarios.

Among the most common types of files that can be recovered are:

  • ImagesJPEG, PNG, TIFF, GIF and many RAW camera formats (CR2, NEF, DCR, SR2, PEF…)
  • Office documents: DOC, DOCX, XLS, XLSX, PPT, as well as OpenOffice and LibreOffice files
  • PDF and HTML files
  • PillsZIP files, including packages containing modern Office documents
  • Audio and video, such as MP3 and other common containers
  • Executables and other binaries in different systems

In many cases, if the data isn't fragmented, the recovered file can be identical to the original . In others, it might appear slightly larger (because it includes garbage at the end), and PhotoRec trims it based on the information it finds in the file header. If the result is smaller than what that header indicates, it considers it corrupt and discards it, unless you explicitly tell it to keep damaged files.

How PhotoRec works internally

To understand why PhotoRec is so effective, it's helpful to briefly review how typical file systems like FAT, NTFS, or ext manage data. These systems store information in blocks (or clusters), the size of which is fixed at the time of formatting and remains constant.

Operating systems attempt to write files contiguously to reduce fragmentation and speed up access, especially on mechanical disks where head seek time is critical. However, with use, writes and deletions inevitably cause data fragmentation.

When you delete a file, what usually happens is that the metadata (name, date, size, block list, etc.) is removed, but the data remains on the disk until another file overwrites it. In ext2/ext3/ext4 systems, for example, the name may still remain for a while, but the reference to the first block disappears, so the system no longer knows where the file actually begins.

PhotoRec begins by determining the block or cluster size of the volume . If the file system is still minimally readable, it extracts this information from the superblock (in ext) or the Volume Boot Record (in FAT and NTFS). Otherwise, it performs an initial pass to locate the first valid files and, based on their positions, calculates the most likely block size.

With that size identifying the basic structure, the program scans the disk block by block , comparing each one against its signature database. If it finds the header of, for example, a JPEG (0xff, 0xd8, 0xff, 0xe0 / 0xe1 / 0xfe), it begins to reconstruct a new file with the corresponding extension. If it later detects another file beginning, it checks that the previous one makes sense and, if everything matches, closes that recovered file and starts with the next one.

Data stream files (such as some MP3s or audio/video streams ) don't always have a fixed header size, so PhotoRec analyzes the content until it considers the stream complete. Simultaneously, it checks previous blocks for headers that it couldn't reconstruct on the first pass, attempting to recover even some fragmented files.

Install PhotoRec and TestDisk on Windows and Linux

The first step to unlocking this full potential is to install the program correctly for your operating system . Although the process is simple, it's advisable to follow a few guidelines to avoid problems and, above all, to prevent accidentally writing to the disk you want to recover.

On Windows, the usual method is to go to the project's official website and download the package that includes TestDisk and PhotoRec. It's completely free and typically comes compressed in a ZIP file that you simply extract to a folder of your choice (preferably a different drive from the one you want to recover).

Inside that folder, you'll find the executable photorec_win.exe , which is the classic text-based version, and also qphotorec_win.exe , which offers a minimalist graphical interface, somewhat more user-friendly for those unfamiliar with console menus. In either case, it's recommended to run them with administrator privileges (right-click > Run as administrator) so they can access the physical devices without restrictions.

In Linux, the process is usually even more straightforward: in Debian/Ubuntu-based distributions, simply open a terminal and type:

sudo apt-get install testdisk

When you install TestDisk, the system will also add PhotoRec. To start it, run it from the terminal with:

sudo photorec

On Unix, BSD, or macOS systems, the idea is similar: run PhotoRec as root (using sudo) to ensure full access to the devices. On macOS, for example, you would launch the corresponding binary (photorec) from the folder where you extracted the TestDisk package.

Basic use of PhotoRec step by step

Although its text-based interface might seem a bit daunting at first, PhotoRec's workflow is quite linear and has a wizard-like feel . With just a few keys (arrows, Enter, C, and Q), you can complete the entire process without overcomplicating things.

Upon startup, the program displays a list of all detected disks and memory devices . Use the up/down arrow keys to select the physical device containing the deleted files and press Enter. If you are on a system with a "RAW" version of the device (such as /dev/rdisk instead of /dev/disk), it is recommended to select the RAW variant because access is usually significantly faster.

Next, PhotoRec will ask you to select the partition table type (MBR, GPT, etc.). It usually detects the correct value automatically, so simply accept the default option unless you are absolutely certain it is incorrect.

On the next screen you will see the disk partitions and unallocated space . There you can:

  • Choose a specific partition and select Search to begin the recovery from that area.
  • Ir a Options If you want to adjust advanced parameters.
  • Walk into File Opt to select which types of files you want to recover and which you don't.

When you launch the search, the program will ask you to specify the file system type . If the partition is ext2/ext3/ext4, you should choose that option. If it's FAT, NTFS, exFAT, HFS+, or similar, you'll need to select the "Other" option , which covers most common file systems on Windows and macOS.

FotoRec lets you choose whether to scan only the free space or the entire partition . Scanning unallocated space focuses on deleted files that haven't yet been overwritten and is usually faster and cleaner. Scanning the entire disk is more thorough, but also slower and can return many more results that aren't always relevant.

The crucial step comes when you have to choose the destination folder where the recovered files will be saved . It's essential that you DO NOT save anything on the same partition you're analyzing, because you could overwrite any remaining data that is still recoverable. Ideally, you should use a different disk, a different partition, or even a different USB drive.

You'll navigate the directory tree using the arrow keys and the option to move up one level using the dots. Once you've selected the folder, press the C key and the scan will begin. From there, it's just a matter of letting it run: depending on the size of the media and the condition of the drive, the process can take anywhere from a few minutes to several hours.

Advanced options and forensic usage modes

PhotoRec includes a number of advanced options designed for complex scenarios or for users who need finer control over how the recovery process is performed. You don't need to use them for normal operation, but it's good to know they exist.

Among the most interesting features is Paranoid mode , which is enabled by default and causes the program to check the validity of recovered files, discarding any that are detected as invalid. Disabling this mode will increase the number of recovered files, but also the amount of junk and corrupted files.

The bruteforce option attempts to reassemble more fragmented JPEG files at the cost of using much more CPU, so it's only worth enabling if you're really desperate to recover certain photos and don't mind the process becoming much slower.

The so-called expert mode lets you manually force the block size and offset, which is only useful when you know exactly what you're doing or in forensic investigations. You can also allow corrupted files to be kept , which is helpful if you plan to run those parts through other repair tools later.

For systems with very little RAM or large, highly fragmented file systems, there is a Low Memory mode that reduces resource usage, but this can affect speed and, in some cases, the depth of the scan. It is a last resort function to be used when the machine freezes during recovery.

If you work with forensic images, PhotoRec can be invoked directly on files such as image.dd o image.E01, and even on sets of files of type image.???It also supports routes such as /cygdrive/d/evidence/image.??? in Cygwin environments. Additionally, you have a mode / log which generates a photorec.log file with the list of recovered files and their location, very useful for documenting the process.

Recover files from Windows with PhotoRec

On Windows, the actual procedure isn't too different from what's been described, but it's worth clarifying since many users will be using it there. To begin, open PhotoRec with an account that has administrator privileges on the computer to ensure access to the physical drives.

When the list of disks appears, use the arrows to select the one containing the lost data and press Enter. Then choose the correct partition (or the "no partition" option if you want PhotoRec to perform a raw scan of the entire disk) and follow the wizard: file system, free space or entire disk, destination folder, and press C to start the scan.

During the process, you'll see the count of found files , the read speed, and the progress displayed on the screen . You can interrupt the search at any time; the recovered files will remain in the recup_dir.1, recup_dir.2, etc. folders, so nothing saved up to that point will be lost.

At the end, PhotoRec displays a summary with the number of files found and their saved locations. Keep in mind that the original file names and folder structure are almost never preserved, as the program works with raw data. Instead, you'll see files with generic names and extensions based on the detected file type.

It's a good idea to temporarily disable real-time antivirus protection to speed up the process, but once you're finished, it's advisable to analyze the recovered files, because you might also recover files that were already infected on the original disk.

File recovery from Linux and other systems

On Linux and other Unix-like systems, the process is virtually identical, with the difference that you'll almost always launch PhotoRec from a terminal using `sudo` . Upon execution, it will detect most devices, including software RAID arrays (such as `/dev/md0`) and volumes encrypted with `cryptsetup`, `dm-crypt`, `LUKS`, or similar tools.

If you want to work on a disk image instead of the actual device, you can pass the filename as an argument: `photorec image.dd` or `photorec image.E01` . This ensures that the physical device is no longer touched and everything is done on a copy, which is highly recommended when the data is particularly sensitive.

On macOS systems, the process is similar: you choose the disk (for example, /dev/disk2 or /dev/rdisk2), select the partition, and follow the usual steps. However, you should be cautious with external drives, as macOS can mount and unmount disks on the fly; ideally, leave them mounted in read-only mode or work directly on an image created with Disk Utility.

In less common environments like OS/2 , PhotoRec only handles image files and not physical disks directly, due to limitations of the operating system itself. In these cases, the workflow always involves first writing the image from the device to a file and then processing that image.

PhotoRec vs. other data recovery programs

Although PhotoRec is incredibly powerful, it's not the perfect tool for everyone. Its text-based interface can be unfriendly, and some advanced features can be intimidating. That's why there are more user-friendly alternatives , which are worth knowing about if PhotoRec doesn't meet your needs or you find it too difficult to use.

On one hand, there are programs like Recuva , very popular on Windows, which offers a quick scan for recently deleted files and a deep scan for more serious cases. It has a very simple graphical interface, filters by file type, and works well with hard drives, USB drives, and SD cards, although its raw power usually falls short of tools like PhotoRec.

Another common name is EaseUS Data Recovery Wizard , a commercial solution with a limited free version that stands out for its guided interface and preview capabilities . It supports damaged drives, formatted volumes, and multiple operating systems, and its user interface is ideal for those who don't want to deal with command-line tools. It's often recommended by the PhotoRec community as a simpler alternative when the command-line interface becomes too complex.

There's also Disk Drill , available for both Windows and macOS, which combines a polished design with good recovery capabilities. It allows you to scan partitions, external devices, and all types of media, and its free version is useful at least for checking if the files you need can be recovered before paying.

Finally, it's impossible not to mention TestDisk , PhotoRec's "sibling" developed by the same author. While PhotoRec focuses on individual files , TestDisk specializes in lost partitions and disks that have stopped booting . In many cases, before launching a scan with PhotoRec, it's a good idea to try TestDisk, because recovering the partition can restore your entire folder system intact and save you a lot of work.

Limitations, actual effectiveness, and best practices

No matter how good a recovery program is, there are situations where there's simply nothing that can be done . Understanding PhotoRec's limitations will help you avoid creating false expectations and make more informed decisions when data is critical.

If the hard drive has severe physical damage (broken read/write head, non-rotating motor, completely unreadable sectors), PhotoRec can't work miracles. In these cases, recovery must be done physically, in a specialized lab with professional tools, and the safest course of action is to turn off the drive and avoid putting any further stress on it. The more you try to fix it at home, the more you risk damaging the drive.

When it comes to disks that have been formatted multiple times or with low-level formatting , things get much more complicated. PhotoRec can recover files if the formatting hasn't yet overwritten the sectors where they were located, but when the content has been repeatedly overwritten, the old information disappears completely. The same thing happens when a secure erase is performed based on write patterns.

If the volume is encrypted (for example, with BitLocker, VeraCrypt, LUKS, etc.), PhotoRec cannot read anything useful unless the encryption layer is active and the key or password is available. Encryption is specifically designed to prevent this type of access, so unless the volume is decrypted, the tool will only see random data.

Another major limitation is that the original file names and folder structure are not recovered . Files are saved in numbered, generically named recup_dir directories, so you then have to manually search for what you need, often relying on the extension, size, modification date, or preview.

Even so, PhotoRec is very effective when the right conditions are met: the storage medium doesn't have significant physical damage, it hasn't been used intensively after the deletion (to avoid overwriting), the file system is one it handles well, and the files aren't extremely fragmented. As a general rule, the sooner you act and the less you touch the device after the incident, the better the chances of success.

Finally, it's worth remembering a couple of best practices: whenever possible, work on a disk image instead of the original , and never save recovered files to the same volume you're analyzing. These two details make all the difference between recovering almost everything and further damaging what little remained intact.

With everything we've seen, it's clear that PhotoRec is an essential tool in any computer emergency kit : it combines power, support for a huge number of systems and formats, and an absolute focus on not touching the source media; it's not perfect, it requires some patience and a certain amount of experience with the console, but in return it offers a recovery capacity that few free solutions can match, and if you accompany it with TestDisk and some alternative with a graphical interface you have practically all the usual data loss scenarios covered.


Add as preferred source in Google