我正在尝试使用ddrescue从SDHC卡中抢救数据:
while true ; do ddrescue -d /dev/mmcblk0p1 mmc.img mmc.log ; done
我不确定是卡上的还是笔记本电脑上的控制器,在读取了一定数量的坏扇区(不是)后,似乎所有扇区(在syslog中显示)都会返回错误。 (显示在syslog中),我发现将卡弹出并再次插入插槽会重置此状态,并再次将好扇区报告为好扇区,直到读取了太多坏扇区为止,依此类推。
目前,我正在使用此循环,注意ddrescue的状态输出,并手动重置卡。有没有一种方法可以在不移除卡的情况下重置控制器,以便救援过程可以在无人值守的情况下运行?
也许是相关的,但是在这台Dell笔记本电脑中,读取器甚至要注意已插入卡,必须在引导或使用过程中完成该操作echo 1 > /sys/bus/pci/rescan
,但只有一次,此后读取器PCI设备就会出现,并且一切正常。
07:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 30)
Subsystem: Dell Device 046e
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at f0600000 (32-bit, non-prefetchable) [size=256]
Capabilities: [a4] Power Management version 3
Capabilities: [80] Express Endpoint, MSI 00
Capabilities: [94] MSI: Enable- Count=1/1 Maskable- 64bit-
Kernel driver in use: sdhci-pci
相关系统日志:
# pop in card
mmc0: new SDHC card at address b368
mmcblk0: mmc0:b368 NCard 15.0 GiB (ro)
mmcblk0: p1
# ddrescue begins to read, error count increases, until at some point:
mmcblk0: error -110 transferring data, sector 12854624, nr 1, cmd response 0x900, card status 0x0
end_request: I/O error, dev mmcblk0, sector 12854624
mmcblk0: error -110 transferring data, sector 12854625, nr 1, cmd response 0x900, card status 0x0
end_request: I/O error, dev mmcblk0, sector 12854625
mmcblk0: error -110 transferring data, sector 12854626, nr 1, cmd response 0x900, card status 0x0
end_request: I/O error, dev mmcblk0, sector 12854626
mmcblk0: error -110 transferring data, sector 12854627, nr 1, cmd response 0x900, card status 0x0
end_request: I/O error, dev mmcblk0, sector 12854627
mmcblk0: error -110 transferring data, sector 12854628, nr 1, cmd response 0x900, card status 0x0
end_request: I/O error, dev mmcblk0, sector 12854628
# time since last successful read increases, pop out card
mmc0: Card removed during transfer!
mmc0: Resetting controller.
mmcblk0: error -123 sending status command, retrying
mmcblk0: error -123 sending status command, retrying
mmcblk0: error -123 sending status command, aborting
mmc0: card b368 removed
# GOTO 10
我还尝试使用USB读卡器,而不是在syslog中生成这些错误,它只是消失了,需要重新插入才能继续。
似乎重新加载sdhci_pci
模块可以解决问题,但是我想知道是否有一种不那么暴力的选择可以做到这一点:
while sleep 1 ; do
ddrescue -d -T 1 /dev/mmcblk0p1 mmc.img mmc.log
modprobe -r sdhci_pci
modprobe sdhci_pci
done