Overview
ddrescue is a data recovery tool from the GNU Project, specialized in safely copying data from damaged storage devices. It efficiently handles read errors and uses log files to allow for resuming the recovery process.
Key Features
- Data recovery from damaged media
- Skipping and retrying bad sectors
- Resuming recovery and efficiency through log files
- Support for various storage devices (HDD, SSD, CD/DVD, etc.)
Key Options
The main options of ddrescue control the recovery method, log file management, and error handling.
Basic Operations and Control
Log File Management
Recovery Strategies
Generated command:
Try combining the commands.
Description:
`ddrescue` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Various ways to use ddrescue to recover data from damaged media.
Basic Recovery
sudo ddrescue /dev/sdb1 /mnt/recovery/image.img recovery.log
Recovers data from the damaged partition /dev/sdb1 to the file image.img and logs the progress in recovery.log.
Force Full Disk Recovery (Direct Access)
sudo ddrescue -f -d /dev/sdb /mnt/recovery/full_disk.img disk_recovery.log
Recovers the entire damaged disk /dev/sdb to full_disk.img. -f means force overwrite, and -d means direct disk access.
Reverse Recovery
sudo ddrescue -R /dev/sdb1 /mnt/recovery/image.img recovery.log
Attempts recovery by starting from the end of the media and working backwards. This may be more effective for certain types of damage.
Specify Number of Retries for Bad Sectors
sudo ddrescue -r 3 /dev/sdb1 /mnt/recovery/image.img recovery.log
Retries reading a bad sector up to 3 times before skipping it.
Installation
ddrescue is not included by default in most Linux distributions and must be installed via a package manager. The package name is typically 'gddrescue'.
Debian/Ubuntu
sudo apt update && sudo apt install gddrescue
Installs ddrescue using the apt package manager.
Fedora/RHEL
sudo dnf install gddrescue
Installs ddrescue using the dnf package manager.
Arch Linux
sudo pacman -S gddrescue
Installs ddrescue using the pacman package manager.
Tips & Precautions
Tips and precautions for using ddrescue effectively for data recovery.
Importance of Log Files
Using log files allows you to resume interrupted recovery processes efficiently by skipping previously recovered parts. Without a log file, you would have to start over from the beginning.
- Using Log Files: `ddrescue` uses log files to track recovery progress, enabling precise resumption of interrupted tasks. This is especially crucial for recovering large media.
- Keeping Log Files: Keep log files safe until the recovery operation is complete. They are useful for retrying if recovery fails.
Ensure Sufficient Destination Space
The destination media where recovered data will be stored must have enough space, preferably larger than the source media.
- Sufficient Space: The destination media for the recovery image file should be equal to or larger than the total size of the source media. Using the sparse file option (-S) can help save space.
Protect the Source Media
Be careful not to cause further damage to the source media during the recovery process. Mount it read-only if possible and avoid other operations.
- Read-Only: If possible, mount the damaged source media in read-only mode to prevent accidental writes.
- Prevent Further Damage: Minimize other operations on the source media during recovery to prevent additional physical or logical damage.
Backup Important Data First
It is recommended to back up important data using other methods before attempting recovery with ddrescue.
- Last Resort: While ddrescue is a powerful tool, data recovery always involves risks. If possible, backing up data through other means before using ddrescue is the safest approach.