Marcio Cunha

Hard drive making noise? How to recover data before failure

Is your hard drive clicking and freezing the system? Learn how to use ddrescue on Linux to safely rescue data from damaged storage drives.

Marcio Cunha•4 min
Also available in:PortuguêsEspañol
Summary
  • Metallic clicks and grinding noises indicate imminent mechanical failure in read heads.
  • The ddrescue utility duplicates sectors while ignoring hardware errors without freezing.
  • Avoid traditional tools like standard dd to prevent stressing defective drives.
  • Creating an image on a healthy hard drive preserves corrupted files for later analysis.
  • Maintaining automated backup copies prevents disasters with aging storage media.

The silent and noisy danger of mechanical hard drives

When a hard drive starts emitting metallic clicks, rhythmic ticking, or high-pitched whines, time is running out. In practice, this means the read and write heads are colliding with the magnetic platters or struggling to position themselves correctly on the tracks. Unlike solid-state drives that suddenly stop working, mechanical disks usually provide clear auditory warnings that their lifespan has reached its end. Attempting to copy files through the operating system's graphical file manager in this scenario is a serious mistake that can freeze the kernel and destroy the last readable vestiges of your information. If you need to rescue crucial documents before total failure, specialized low-level cloning tools become indispensable.

Why traditional tools fail on damaged storage media

Common copy utilities, such as the native Linux dd command or graphical backup software, operate under the premise that the storage medium responds perfectly. When they encounter a bad sector where magnetism has faded or the physical surface has suffered scratches, these applications freeze, generate input/output errors known as I/O errors, and further stress the drive motor. In practice, insisting on repeated linear reads over the same corrupted area wears out the hardware rapidly, raising temperatures and accelerating the final death of the component. To circumvent this issue, data recovery engineering adopts approaches that prioritize the rapid extraction of healthy areas before insisting on problematic sections.

Understanding ddrescue for safe cloning on Linux

Ddrescue is free software designed to copy data from a file or block device to another, working intelligently with defective media. In practice, it divides the task into two distinct phases: first, it copies everything it can read easily at high speed, ignoring bad spots; then, it returns to thoroughly reexamine only the sectors that failed. This strategy minimizes the time the defective drive spends under maximum mechanical stress, maximizing the amount of data recovered before the motor stops spinning altogether. Even if you are not a systems engineer, understanding the basic operation of this tool ensures you know how to handle hardware crises in servers or workstations professionally.

Step-by-step guide to extracting data with ddrescue

Before running any rescue command, make sure to connect the damaged drive to a stable Linux machine and have a second healthy disk with equal or greater capacity to store the cloned image. Open the terminal and identify the devices using the lsblk command to correctly map which letter represents the defective drive and which belongs to the destination disk. Never write data over the problematic drive. In practice, the process involves installing the gddrescue package via your distribution's package manager and executing the main cloning command with log-saving parameters. As we detailed when analyzing corporate system stability, such as in our guide on how to scale PostgreSQL for high data volume, precision in manipulating blocks prevents catastrophic losses of sensitive data during critical maintenance moments.

sudo apt update && sudo apt install gddrescue -y
sudo ddrescue -d -r3 /dev/sdb /mnt/backup/rescue_disk.img /mnt/backup/mapfile.log

In the command above, the -d parameter enables direct disk access bypassing the operating system cache, while -r3 instructs the program to try reading each problematic sector up to three times before giving up on that specific fraction. The mapfile generated during the process is the true map, as it records exactly which blocks were successfully recovered and which remain unreadable, allowing you to close and reopen the terminal without losing scan progress.

What to do after generating the disk image

Once ddrescue completes the mapping and extraction of available blocks, the original drive can be disconnected and safely retired since its useful cycle has ended. From that moment on, all file recovery work occurs exclusively on top of the image file generated on the healthy disk. You can mount this image as a virtual file system in Linux using loop device commands or explore it with specialized software for recovering lost partitions, such as TestDisk and Photorec. In practice, this isolates the physical problem and protects against any accidental command destroying remaining data. Maintaining verification routines and constant alerts on your servers, avoiding surprises with sudden hardware failures, is the best guarantee for the long-term integrity of any modern technology infrastructure.