我有一个老旧的硬盘,上面有很多坏扇区,我想尽可能多地保存其中的数据(最后还是要扔掉)。在装有ddrescue
macOS 的笔记本电脑上使用效果很好,我能够保存硬盘中大约 95% 的数据,但是删除坏扇区周围的最后几位数据非常慢,因为macOS 上没有-d
该选项(绕过内核缓存的直接磁盘访问) 。ddrescue
出于这个原因,我只能使用我的旧 RasperryPi 3b 和 Ubuntu 20.04 LTS,并让它ddrescue
运行几天,以从驱动器中抓取最后的一些数据。
但是,当我将驱动器连接到 RPi 时,我根本无法使用它。它显示lsblk
正确的大小,但驱动器上的任何读取操作都会冻结。连接后,驱动器旋转起来,然后,几秒钟后,出现了明显的点击(我猜是硬盘的磁头弹回)。这种声音每 10-25 秒重复一次,据我所知,这是硬盘即将报废的典型迹象。但是当我将硬盘连接到我的 Mac 时,没有点击s 和非坏区都是完全可读的。
我检查了系统日志,它显示磁盘上的各个扇区存在一些读取错误,这让我感到很奇怪,因为我从来没有安装过该磁盘(并且也不打算这样做,ddrescue 建议甚至不要安装该驱动器以尽可能减少潜在损害)。
这是我连接驱动器、等待五次点击,然后再次断开驱动器连接后的系统日志:
Oct 23 17:46:34 qtpi kernel: [ 681.381739] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
Oct 23 17:46:35 qtpi kernel: [ 681.524105] usb 1-1.2: New USB device found, idVendor=174c, idProduct=55aa, bcdDevice= 1.00
Oct 23 17:46:35 qtpi kernel: [ 681.524123] usb 1-1.2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
Oct 23 17:46:35 qtpi kernel: [ 681.524138] usb 1-1.2: Product: ASMT1051
Oct 23 17:46:35 qtpi kernel: [ 681.524152] usb 1-1.2: Manufacturer: asmedia
Oct 23 17:46:35 qtpi kernel: [ 681.524166] usb 1-1.2: SerialNumber: 123456789012
Oct 23 17:46:35 qtpi kernel: [ 681.592932] usb 1-1.2: UAS is blacklisted for this device, using usb-storage instead
Oct 23 17:46:35 qtpi kernel: [ 681.592946] usb-storage 1-1.2:1.0: USB Mass Storage device detected
Oct 23 17:46:35 qtpi kernel: [ 681.598080] usb-storage 1-1.2:1.0: Quirks match for vid 174c pid 55aa: 400000
Oct 23 17:46:35 qtpi kernel: [ 681.598254] scsi host0: usb-storage 1-1.2:1.0
Oct 23 17:46:35 qtpi kernel: [ 681.598774] usbcore: registered new interface driver usb-storage
Oct 23 17:46:35 qtpi kernel: [ 681.613963] usbcore: registered new interface driver uas
Oct 23 17:46:36 qtpi kernel: [ 682.630848] scsi 0:0:0:0: Direct-Access ASMT 2105 0 PQ: 0 ANSI: 6
Oct 23 17:46:36 qtpi kernel: [ 682.632467] sd 0:0:0:0: Attached scsi generic sg0 type 0
Oct 23 17:46:36 qtpi kernel: [ 682.635097] sd 0:0:0:0: [sda] Spinning up disk...
Oct 23 17:46:51 qtpi kernel: [ 683.653711] ...............ready
Oct 23 17:46:58 qtpi kernel: [ 704.774566] sd 0:0:0:0: [sda] 586114704 512-byte logical blocks: (300 GB/279 GiB)
Oct 23 17:46:58 qtpi kernel: [ 704.775233] sd 0:0:0:0: [sda] Write Protect is off
Oct 23 17:46:58 qtpi kernel: [ 704.775252] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
Oct 23 17:46:58 qtpi kernel: [ 704.775891] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Oct 23 17:46:58 qtpi kernel: [ 704.822380] sda: sda1
Oct 23 17:46:58 qtpi multipath: sda: can't store path info
Oct 23 17:47:12 qtpi kernel: [ 718.781052] sd 0:0:0:0: [sda] Attached SCSI disk
Oct 23 17:47:44 qtpi kernel: [ 750.657944] usb 1-1.2: reset high-speed USB device number 4 using dwc_otg
Oct 23 17:47:44 qtpi kernel: [ 750.803479] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_TIME_OUT driverbyte=DRIVER_OK
Oct 23 17:47:44 qtpi kernel: [ 750.803524] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 00 00 08 00 00 08 00
Oct 23 17:47:44 qtpi kernel: [ 750.803547] blk_update_request: I/O error, dev sda, sector 8 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
Oct 23 17:47:58 qtpi systemd-udevd[900]: sda: Worker [1977] processing SEQNUM=5385 is taking a long time
Oct 23 17:48:05 qtpi kernel: [ 771.966758] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
Oct 23 17:48:05 qtpi kernel: [ 771.966784] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 22 ef 66 88 00 00 01 00
Oct 23 17:48:05 qtpi kernel: [ 771.966808] blk_update_request: I/O error, dev sda, sector 586114696 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
Oct 23 17:48:19 qtpi kernel: [ 785.798862] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
Oct 23 17:48:19 qtpi kernel: [ 785.798888] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 00 00 40 00 00 08 00
Oct 23 17:48:19 qtpi kernel: [ 785.798913] blk_update_request: I/O error, dev sda, sector 64 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
Oct 23 17:48:28 qtpi kernel: [ 795.238641] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
Oct 23 17:48:28 qtpi kernel: [ 795.238667] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 00 00 80 00 00 08 00
Oct 23 17:48:28 qtpi kernel: [ 795.238692] blk_update_request: I/O error, dev sda, sector 128 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
Oct 23 17:48:28 qtpi kernel: [ 795.238864] usb 1-1.2: USB disconnect, device number 4
Oct 23 17:48:28 qtpi kernel: [ 795.252762] sd 0:0:0:0: [sda] Synchronizing SCSI cache
Oct 23 17:48:28 qtpi kernel: [ 795.258161] blk_update_request: I/O error, dev sda, sector 128 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Oct 23 17:48:28 qtpi kernel: [ 795.268556] Buffer I/O error on dev sda, logical block 16, async page read
Oct 23 17:48:28 qtpi kernel: [ 795.275921] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
Oct 23 17:48:28 qtpi multipathd[1497]: uevent trigger error
Oct 23 17:48:29 qtpi multipathd[1497]: sda: path already removed
根据日志,读取操作正在多个扇区(8、64、128 和 586114696)上进行,尽管我不明白为什么要进行这些读取。在我的 Mac 上,扇区 8、64 和 128 肯定是可读的,但第一个坏扇区不会在 350MB 左右之前出现。每个读取错误似乎都对应一个点击。此行为可能由什么原因造成?我该如何修复?
答案1
就像 RPi 经常出现的情况一样,这是一个功耗问题。在我将一个有源 USB 集线器放在驱动器的 ATA-USB 适配器(驱动器已经有自己的电源,这让我认为我不需要另一个电源适配器)和 rpi 之间后,一切都正常工作。
感谢@danzel 的正确直觉。