我有光学介质(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.
发布评论
评论(7)
man readom
,cdrecord自带的程序:man readom
, a program that comes with cdrecord:最好的可用工具是 dd_rhelp。 只需
喝杯茶并观看精美的图形即可。
dd_rhelp rpm 软件包信息:
我自己也用过很多次,非常非常可靠。
您可以将其从 DAG 安装到类似 Red Hat 的发行版。
The best tool avaliable is dd_rhelp. Just
,take a cup of tea and watch the nice graphics.
The dd_rhelp rpm package info:
I've used it a lot myself and Is very, very realiable.
You can install it from DAG to Red Hat like distributions.
由于建议使用 dd,我应该注意到我知道它的存在并且已经使用了 sg_dd,但我的问题不是关于命令(1)或(1m),而是关于系统调用(2)或库(3)。
编辑
另一个有帮助的linux命令行实用程序是sdparm。 以下标志似乎禁用硬件重试:
其中
/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:where
/dev/sr0
is the device for the optical drive in my case.在检查 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.由于您询问的是驱动程序级别访问权限,因此您应该研究 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
看一下 ASPI 界面。 Windows 和 Linux 上均可使用。
Take a look at the ASPI interface. Available on both windows and linux.
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.