SysTutorials

Recovering Data from a Failed Hard Drive

· updated April 11, 2026

When a hard drive fails physically, data recovery becomes challenging but sometimes possible. If the drive isn’t recognized by the system or showing signs of mechanical failure, professional recovery services may be necessary, but they’re expensive. Before going that route, you can attempt recovery yourself using open-source tools.

When to attempt DIY recovery

You can safely attempt recovery if:

If the drive makes unusual noises or isn’t detected at all, the platters or read/write heads are likely damaged: professional recovery is your only option.

Using PhotoRec for file recovery

PhotoRec is a free, open-source tool designed to recover lost files. Despite its name, it recovers far more than photos: it can reconstruct hundreds of file types including documents, archives, databases, and media files.

Install PhotoRec on your recovery system:

# Ubuntu/Debian
sudo apt install testdisk

# RHEL/CentOS/Fedora
sudo dnf install testdisk

# macOS
brew install testdisk

PhotoRec is bundled with TestDisk, a companion tool for partition recovery.

Recovery procedure

Connect the failed drive via USB adapter or dock to another working system. Identify the device:

lsblk
sudo fdisk -l | grep -E "^/dev"

Run PhotoRec (use sudo for full access):

sudo photorec /dev/sdX

Replace sdX with your actual device (e.g., sdb). PhotoRec opens an interactive menu:

  1. Select the device partition or entire disk
  2. Choose the filesystem type (or let it auto-detect)
  3. Select the recovery destination (must be a different drive with sufficient space)
  4. Start the scan

PhotoRec performs a deep scan of the drive, reading raw data blocks and identifying file signatures. The process can take hours for large drives. Recovered files are written to the destination drive in numbered directories.

What files can be recovered

PhotoRec supports recovery of over 400 file types, including:

See the complete list at the PhotoRec documentation.

Limitations and alternatives

PhotoRec has drawbacks:

For more aggressive recovery targeting specific partitions, try TestDisk (included in the same package) to rebuild partition tables before running PhotoRec.

If the drive contains RAID arrays or complex storage setups, ddrescue can create an image of the drive for safer recovery attempts:

sudo ddrescue -n /dev/sdX /path/to/image.img /path/to/mapfile.map

This copies readable sectors and logs bad blocks, allowing multiple recovery attempts without stressing the failing drive further.

When professional recovery is necessary

Professional data recovery services cost $300–$3,000+ but are worth it if:

Budget several days for recovery regardless of method: don’t expect instant results.

← All posts