algorithm - Ddrescue(GNU) 算法

标签 algorithm hardware

http://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html

The algorithm of ddrescue is as follows (the user may interrupt the process at any point, but be aware that a bad drive can block ddrescue for a long time until the kernel gives up):

1) Optionally read a logfile describing the status of a multi-part or previously interrupted rescue. If no logfile is specified or is empty or does not exist, mark all the rescue domain as non-tried.

2) (First phase; Copying) Read the non-tried parts of the input file, marking the failed blocks as non-trimmed and skipping beyond them, until all the rescue domain is tried. Only non-tried areas are read in large blocks. Trimming, splitting and retrying are done sector by sector. Each sector is tried at most two times; the first in this step as part of a large block read, the second in one of the steps below as a single sector read.

3) (Second phase; Trimming) Read forwards one sector at a time from the leading edge of the largest non-trimmed block, until a bad sector is found. Then read backwards one sector at a time from the trailing edge of the same block, until a bad sector is found. For each non-trimmed block, mark the bad sectors found as bad-sector and mark the rest of that block as non-split. Repeat until there are no more non-trimmed blocks.

4) (Third phase; Splitting) Read forwards one sector at a time from the center of the largest non-split block, until a bad sector is found. Then read backwards one sector at a time from the center of the same block, until a bad sector is found. If the logfile is larger than --logfile-size', read the smallest non-split blocks until the number of entries in the logfile drops below--logfile-size'. Repeat until all remaining non-split blocks have less than 5 sectors. Then read the remaining non-split blocks sequentially.

5) (Fourth phase; Retrying) Optionally try to read again the bad sectors until the specified number of retries is reached.

6) Optionally write a logfile for later use.

我的理解: ** 当他抄写时 ** 他只是一一复制区 block ,从不退却去复制旧的区 block 。任何包含有缺陷扇区的 block 都被标记为坏 block (整个 block )。坏 block 被标记为未修剪。

图例:

=1 2 3= is a bad BLOCK
[1 2 3] is a good block
x is a bad sector
@ is the read cursor
in a =1 2 3= center sector(2) is always bad

当他修剪时 从最大的未修剪 block 的前沿开始向前读取一个扇区,直到发现坏扇区。

=1 2 3= [4 5 6] =7 8 9=@ [10 11 12] =13 14 15=

=1 2 3= [4 5 6] =7 8 9= [10 11 12] =13 @14 15=

然后从同一 block 的后沿开始向后读取一个扇区,直到发现坏扇区。

=1 2 3= [4 5 6] @=7 8 9= [10 11 12] =13 14 15=

=1 @2 3= [4 5 6] =7 8 9= [10 11 12] =13 14 15=

对于每个未修剪的 block ,将发现的坏扇区标记为坏扇区,并将该 block 的其余部分标记为未分割。

=1 x 3= [4 5 6] =7 8 9= [10 11 12] =13 x 15=
  1. 他为什么要这样做?为什么他不能线性复制并且每次遇到坏扇区时就跳过它 - 在我看来他所做的只是从坏 block 中提取工作扇区。

  2. 我陷入了“修剪”阶段,而且拆分情况更糟 - 有人可以阅读该文档来解释这一切吗!

  3. 他怎么可能重试!他可以重试坏扇区,但由于他已经修剪了 block 并将其写出 - 他将如何插入重试后恢复的数据?

最佳答案

  1. 坏扇区自然会成群出现...如果我用锤子轻轻敲击正在工作的驱动器,磁头很可能会划伤表面...正在旋转...因此它将产生一个很好的效果存储表面上的同心圆。 在坏 block 之后尝试坏 block 通常是浪费时间...并且在大多数情况下坏驱动器已经没有多少时间了...

  2. 修剪未知范围后,边缘很可能有坏扇区 - 这就是 split 从中心开始的原因......这可能是健康的......

  3. 它通过使用 fseek() 或类似的东西来寻找目标扇区...ddrescue 就像类固醇上的 dd...它有能力“知道”已读取哪些数据,但它忽略了磁盘上所有不可读的部分

关于algorithm - Ddrescue(GNU) 算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17637294/

相关文章:

c++ - 单值分解实现 C++

javascript - Node.js - 公开吗?

java - 你们的 JBoss 5 开发环境是什么?

c++ - 使用顶点缓冲区用 OpenGL 显示规则网格的最快方法是什么?

arrays - 算法 - 找到中心索引

arrays - 如何找出任意两个元素和> k的子数组?

hardware - 哪里有关于低级 PC 启动的好信息?

hardware - Google Colaboratory 的硬件规范是什么?

.net - 从 Internet Explorer 访问硬件

python - 通过 Needleman Wunsch 表进行回溯