Not*_*ist 16 linux hard-drive data-recovery dd bad-sectors
最近我试图dd从一个不健康的硬盘驱动器到一个文件。我用过dd if=/dev/sdb of=somefile bs=4096 conv=noerror,sync。我的问题是dd当它遇到坏块时浪费了很多时间。在我的用例中,我很乐意为更快的结果支付一些数据丢失的费用。
有什么方法可以使错误处理更快?也许是内核调整(告诉 HDD 减少读取块的工作量)?还是其他程序?
Sli*_*red 32
首先,对于要使用的软件:您可以尝试使用ddrescue而不是dd.
ddrescue有一个开关,只能进行有限次数的重试。它还可以使用日志文件,以便记录哪些块是坏的。如果您稍后想要进行更多重试,您可以使用相同的日志文件以不同的选项ddrescue 再次运行(例如更多重试),它只会重试必要的块。
用法示例:
# ddrescue -n /dev/sda /dev/sdb rescue.log
# ddrescue -r1 /dev/sda /dev/sdb rescue.log
Run Code Online (Sandbox Code Playgroud)
从ddrescue信息页面:
-n, --no-scrape
Skip the scraping phase. Avoids spending a lot of time
trying to rescue the most difficult parts of the file.
-r, --retry-passes=<n>
Exit after given number of retry passes. Defaults to 0.
-1 means infinity. Every bad sector is tried only once
in each pass. To retry bad sectors detected on a previous
run, you must specify a non-zero number of retry passes.
Run Code Online (Sandbox Code Playgroud)
以下是使用的一些其他来源ddrescue:
info ddrescue在案件本身花费的时间太长了硬盘驱动器,你可以尝试启用了一个叫做TLER(牛逼IME大号imited Ë RROR [R ecovery)或CCTL(ç ommand ç ompletion牛逼IME大号IMIT)。并非所有 HDD 都有它,但您可以使用它来限制 HDD 控制器本身的时间。ddrecue当然,这种方法可以与 using 结合使用。
Linux 有一个名为smartctl(在smartmontools包中)的工具。
要检查当前设置(“禁用”意味着无限时间,您不想要):
# smartctl -l scterc /dev/sda
Run Code Online (Sandbox Code Playgroud)
要将其设置为固定值(在此示例中为 5.0 秒。将其设置为 0 将禁用 TLER):
# smartctl -l scterc,50,50 /dev/sda
Run Code Online (Sandbox Code Playgroud)
TLER 来源:http : //en.wikipedia.org/wiki/TLER