从光学介质中恢复忽略读取错误

发布于 2024-07-06 12:34:39 字数 286 浏览 12 评论 0 原文

我有光学介质(CD 和 DVD)中存档的文件备份。 这些都有 par2 恢复文件,存储在单独的介质上。 即使在没有 par2 文件的情况下,在一个光驱上读取时出现的小错误也可以在另一驱动器上正常读取。

问题是,当读取有故障的介质时,读取时间非常非常长,因为设备往往会重试多次。

问题是:如何控制重试次数(即设置为不重试或仅重试一次)? 一些系统调用? 我可以下载一个库吗? 我必须在 SCSI 层上工作吗?

问题主要是关于 Linux 的,但任何 Win32 指针也将受到欢迎。

I have backups of files archived in optical media (CDs and DVDs). These all have par2 recovery files, stored on separate media. Even in cases where there are no par2 files, minor errors when reading on one optical drive can be read fine on another drive.

The thing is, when reading faulty media, the read time is very, very long, because devices tend to retry multiple times.

The question is: how can I control the number of retries (ie set to no retries or only one try)? Some system call? A library I can download? Do I have to work on the SCSI layer?

The question is mainly about Linux, but any Win32 pointers will be more than welcome too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

蔚蓝源自深海 2024-07-13 12:34:39

man readom,cdrecord自带的程序:

   -noerror
          Do not abort if the high level error checking in readom found an
          uncorrectable error in the data stream.

   -nocorr
          Switch  the  drive  into  a mode where it ignores read errors in
          data sectors that are a result of uncorrectable  ECC/EDC  errors
          before reading.  If readom completes, the error recovery mode of
          the drive is switched back to the remembered old mode.
   ...

   retries=#
          Set the retry count for high level retries in readom to #.   The
          default  is  to do 128 retries which may be too much if you like
          to read a CD with many unreadable sectors.

man readom, a program that comes with cdrecord:

   -noerror
          Do not abort if the high level error checking in readom found an
          uncorrectable error in the data stream.

   -nocorr
          Switch  the  drive  into  a mode where it ignores read errors in
          data sectors that are a result of uncorrectable  ECC/EDC  errors
          before reading.  If readom completes, the error recovery mode of
          the drive is switched back to the remembered old mode.
   ...

   retries=#
          Set the retry count for high level retries in readom to #.   The
          default  is  to do 128 retries which may be too much if you like
          to read a CD with many unreadable sectors.
乖不如嘢 2024-07-13 12:34:39

最好的可用工具是 dd_rhelp。 只需

dd_rhelp /dev/cdrecorder /home/myself/DVD.img

喝杯茶并观看精美的图形即可。

dd_rhelp rpm 软件包信息:

dd_rhelp 在整个光盘上使用 ddrescue,并尝试收集最大
在尝试对坏扇区进行长时间尝试之前,请先获取有效数据。 如果您离开 dd_rhelp 工作
对于无限时间,它具有与简单的 dd_rescue 类似的效果。 但是因为
你可能没有无限的时间,dd_rhelp 跳过坏扇区并进行救援
有效数据。 从长远来看,它会使用 dd_rescue 解析您的所有设备。

您可以随时按 Ctrl-C 组合键,然后随意重新运行它,dd_rhelp 将恢复
作业,因为它取决于 dd_rescue 创建的日志文件。 另外,进展
显示在您的设备被救援的 ASCII 图片中。

我自己也用过很多次,非常非常可靠。

您可以将其从 DAG 安装到类似 Red Hat 的发行版。

The best tool avaliable is dd_rhelp. Just

dd_rhelp /dev/cdrecorder /home/myself/DVD.img

,take a cup of tea and watch the nice graphics.

The dd_rhelp rpm package info:

dd_rhelp uses ddrescue on your entire disc, and attempts to gather the maximum
valid data before trying for ages on badsectors. If you leave dd_rhelp work
for infinite time, it has a similar effect as a simple dd_rescue. But because
you may not have this infinite time, dd_rhelp jumps over bad sectors and rescue
valid data. In the long run, it parses all your device with dd_rescue.

You can Ctrl-C it whenever you want, and rerun-it at will, dd_rhelp resumes the
job as it depends on the log files dd_rescue creates. In addition, progress
is shown in an ASCII picture of your device being rescued.

I've used it a lot myself and Is very, very realiable.

You can install it from DAG to Red Hat like distributions.

难忘№最初的完美 2024-07-13 12:34:39

由于建议使用 dd,我应该注意到我知道它的存在并且已经使用了 sg_dd,但我的问题不是关于命令(1)或(1m),而是关于系统调用(2)或库(3)。

编辑

另一个有帮助的linux命令行实用程序是sdparm。 以下标志似乎禁用硬件重试:

sudo sdparm --set=RRC=0 /dev/sr0

其中 /dev/sr0 是我的情况下的光驱设备。

Since dd was suggested, I should note that I know of the existence and have used sg_dd, but my question was not about commands (1) or (1m), but about system calls (2) or libraries (3).

EDIT

Another linux command-line utility that is of help, is sdparm. The following flag seems to disable hardware retries:

sudo sdparm --set=RRC=0 /dev/sr0

where /dev/sr0 is the device for the optical drive in my case.

巾帼英雄 2024-07-13 12:34:39

在检查 hdparm 是否可以修改重试次数(似乎不能)时,我认为根据错误类型,降低 CD-ROM 速度可能会减少读取错误的次数,这实际上可以提高平均读取速度。 然而,如果某些扇区完全无法读取,那么即使降低 CD-ROM 速度也无济于事。

While checking whether hdparm could modify the number of retries (doesn't seem so), I thought that, depending on the type of error, lowering the CD-ROM speed could potentially reduce the number of read errors, which could actually increase the average read speed. However, if some sectors are completely unreadable, then even lowering the CD-ROM speed won't help.

偷得浮生 2024-07-13 12:34:39

由于您询问的是驱动程序级别访问权限,因此您应该研究 SCSI 命令,或者可能是类似 ASPI 的 API。 在 Windows 上,VSO 软件(下面是blindread/blindwrite 的开发人员)开发了一个更好的 API Patin-Couffin,它提供锁定的低级访问:

http://en.wikipedia.org/wiki/Patin-Couffin

这可能会帮助您入门。 然而,归根结底,驱动器是与 SCSI 命令连接的,即使它实际上是 USB、SATA、ATA、IDE 或其他接口。 您还可以查找与 ATAPI 相关的术语,这是该 CD-ROM SCSI 层接口的最早规范之一。

如果您找不到合适的 Linux 库或使用上述搜索术语和概念处理较低级别命令的示例,我会感到惊讶。


较旧的答案:

Blindread/blindwrite 是在 cd-rom 保护方案的鼎盛时期开发的,通常使用故意坏扇区或错误信息以验证原始 CD。

它将允许您设置一系列参数,包括重试。 请记住,CD-ROM 驱动器本身决定重试次数,并且我不确定这是否可以通过许多(大多数?)CD-ROM 驱动器的软件进行设置。

您可以将磁盘复制为 ISO 格式,忽略错误,然后使用 ISO 实用程序读取数据。

-亚当

Since you are asking about driver level access, you should look into SCSI commands, or perhaps an ASPI like API. On windows VSO software (developers of blindread/blindwrite below) have developed a much better API, Patin-Couffin, that provides locked low level access:

http://en.wikipedia.org/wiki/Patin-Couffin

That might get you started. However, at the end of the day, the drive is interfaced with SCSI commands, even if it's actually USB, SATA, ATA, IDE, or otherwise. You might also look up terms related to ATAPI, which was one of the first specifications for this CD-ROM SCSI layer interface.

I'd be surprised if you couldn't find a suitable linux library or example of dealing with the lower level commands using the above search terms and concepts.


Older answer:

Blindread/blindwrite was developed in the heyday of cd-rom protection schemes often using intentionally bad sectors or error information to verify the original CD.

It will allow you to set a whole slew of parameters, including retries. Keep in mind that the CD-ROM drive itself determines how many times to retry, and I'm not sure that this is settable via software for many (most?) CD-ROM drives.

You can copy the disk to ISO format, ignoring the errors, and then use ISO utilities to read the data.

-Adam

挽手叙旧 2024-07-13 12:34:39

看一下 ASPI 界面。 Windows 和 Linux 上均可使用。

Take a look at the ASPI interface. Available on both windows and linux.

白日梦 2024-07-13 12:34:39

dd(1) 是你的朋友。

dd if=/dev/cdrom of=image bs=2352 conv=noerror,notrunc

驱动器可能仍会重试一下,但我认为如果不修改固件,您不会得到任何改善。

dd(1) is your friend.

dd if=/dev/cdrom of=image bs=2352 conv=noerror,notrunc

The drive may still retry a bit, but I don't think you'll get any better without modifying firmware.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文