Linux command
ddrescue 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo ddrescue [/dev/sdb] [path/to/image.dd] [path/to/log.txt]
Clone
sudo ddrescue -f -n [/dev/sdX] [/dev/sdY] [path/to/log.txt]
说明
ddrescue is a data recovery tool that copies data from one block device to another while handling read errors intelligently. Unlike dd, which stops on the first read error, ddrescue skips bad sectors and continues copying good data, then returns to problematic areas for repeated retry attempts. The logfile tracks which blocks have been successfully copied, which failed, and which remain untried. This allows operations to be interrupted and resumed without starting over, making it practical to run multiple passes over days or weeks. The first pass typically uses -n to quickly copy all readable data, skipping errors. Subsequent passes focus on bad sectors with different strategies. ddrescue employs sophisticated algorithms to maximize data recovery from failing drives. It can read in reverse, try different block sizes, and make multiple attempts with delays between retries, as sometimes failing drives become temporarily more cooperative. The tool is essential for recovering data from physically damaged media, handling situations where traditional copying tools would fail completely. Always work with a spare drive for recovered data rather than attempting in-place recovery.
参数
- -f, --force
- Overwrite output device
- -n, --no-scrape
- Skip scraping phase (faster first pass)
- -r, --retry-passes _n_
- Maximum retry passes for bad sectors
- -d, --direct
- Use direct I/O
- -R, --reverse
- Read input in reverse
FAQ
What is the ddrescue command used for?
ddrescue is a data recovery tool that copies data from one block device to another while handling read errors intelligently. Unlike dd, which stops on the first read error, ddrescue skips bad sectors and continues copying good data, then returns to problematic areas for repeated retry attempts. The logfile tracks which blocks have been successfully copied, which failed, and which remain untried. This allows operations to be interrupted and resumed without starting over, making it practical to run multiple passes over days or weeks. The first pass typically uses -n to quickly copy all readable data, skipping errors. Subsequent passes focus on bad sectors with different strategies. ddrescue employs sophisticated algorithms to maximize data recovery from failing drives. It can read in reverse, try different block sizes, and make multiple attempts with delays between retries, as sometimes failing drives become temporarily more cooperative. The tool is essential for recovering data from physically damaged media, handling situations where traditional copying tools would fail completely. Always work with a spare drive for recovered data rather than attempting in-place recovery.
How do I run a basic ddrescue example?
Run `sudo ddrescue [/dev/sdb] [path/to/image.dd] [path/to/log.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f, --force do in ddrescue?
Overwrite output device