背景:
我有一个旧硬盘,我想从中保存数据(重要,但不是那么紧急)。我使用 SATA 适配器(和外部电源)将硬盘连接到我的笔记本电脑。lsusb
我的适配器名为“ID 05e3:0718 Genesys Logic, Inc. IDE/SATA 适配器”。该适配器可以正常工作,我已将它与另一个驱动器一起使用,速度很快,没有任何问题。
以下是有问题的 HD 的行为:
我打开电源,等待。我插入 USB。过了一会儿,Linux 识别了它,我可以挂载它,并浏览数据。所有数据都完好无损,但是访问速度极慢(kb/s 范围)。我尝试使用 rsync 来启动我的备份rsync -aP path1 path2
。它工作了一段时间,然后突然我收到“文件已消失”的消息。驱动器突然不再安装,它无法识别,它不存在。如果我在安装驱动器后根本不访问它,也会发生这种情况。拔下并重新插入 USB 适配器(不关闭驱动器电源)使 Linux 再次识别它。然后我重复这个过程(非常艰巨)。
我的问题:
有没有办法可以消除我的问题,或者至少可以自动执行“重启”过程。
dmesg 输出:
[ 6378.319663] usb 3-2: new high-speed USB device number 27 using xhci_hcd
[ 6378.338124] usb 3-2: New USB device found, idVendor=05e3, idProduct=0718
[ 6378.338135] usb 3-2: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[ 6378.338141] usb 3-2: Product: USB Storage
[ 6378.338146] usb 3-2: SerialNumber: 000000000033
[ 6378.339121] usb-storage 3-2:1.0: USB Mass Storage device detected
[ 6378.339479] scsi26 : usb-storage 3-2:1.0
[ 6379.342076] scsi 26:0:0:0: Direct-Access WDC WD50 00AAKS-00V1A0 0016 PQ: 0 ANSI: 4
[ 6379.342946] sd 26:0:0:0: Attached scsi generic sg2 type 0
[ 6379.343689] sd 26:0:0:0: [sdb] 976773164 512-byte logical blocks: (500 GB/465 GiB)
[ 6379.344240] sd 26:0:0:0: [sdb] Write Protect is off
[ 6379.344264] sd 26:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 6379.344761] sd 26:0:0:0: [sdb] No Caching mode page found
[ 6379.344769] sd 26:0:0:0: [sdb] Assuming drive cache: write through
[ 6379.351684] sd 26:0:0:0: [sdb] No Caching mode page found
[ 6379.351693] sd 26:0:0:0: [sdb] Assuming drive cache: write through
[ 6379.406202] sdb: sdb1 sdb2 sdb3
[ 6379.407815] sd 26:0:0:0: [sdb] No Caching mode page found
[ 6379.407819] sd 26:0:0:0: [sdb] Assuming drive cache: write through
[ 6379.407821] sd 26:0:0:0: [sdb] Attached SCSI disk
然后我就可以访问sdb: sdb1 sdb2 sdb3
相关内容。
驱动器死机后:
[ 6922.219418] systemd-hostnamed[4412]: Warning: nss-myhostname is not installed. Changing the local hostname might make it unresolveable. Please install nss-myhostname!
[ 6923.753466] usb 3-2: USB disconnect, device number 28
[ 6923.811243] scsi 27:0:0:0: rejecting I/O to offline device
[ 6923.811249] scsi 27:0:0:0: [sdb] killing request
[ 6923.811283] scsi 27:0:0:0: [sdb] Unhandled error code
[ 6923.811285] scsi 27:0:0:0: [sdb]
[ 6923.811288] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[ 6923.811290] scsi 27:0:0:0: [sdb] CDB:
[ 6923.811291] Read(10): 28 00 1e ec 26 18 00 00 f0 00
[ 6923.811299] end_request: I/O error, dev sdb, sector 518792728
[ 6923.811302] quiet_error: 258 callbacks suppressed
[ 6923.811305] Buffer I/O error on device sdb3, logical block 6278680
[ 6923.811308] Buffer I/O error on device sdb3, logical block 6278681
[ 6923.811309] Buffer I/O error on device sdb3, logical block 6278682
[ 6923.811311] Buffer I/O error on device sdb3, logical block 6278683
[ 6923.811313] Buffer I/O error on device sdb3, logical block 6278684
[ 6923.811316] Buffer I/O error on device sdb3, logical block 6278685
[ 6923.811318] Buffer I/O error on device sdb3, logical block 6278686
[ 6923.811320] Buffer I/O error on device sdb3, logical block 6278687
[ 6923.811325] Buffer I/O error on device sdb3, logical block 6278688
[ 6923.811328] Buffer I/O error on device sdb3, logical block 6278689
[ 6923.811441] scsi 27:0:0:0: rejecting I/O to offline device
[ 6923.811445] scsi 27:0:0:0: [sdb] killing request
[ 6923.811707] scsi 27:0:0:0: [sdb] Unhandled error code
[ 6923.811710] scsi 27:0:0:0: [sdb]
[ 6923.811712] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[ 6923.811714] scsi 27:0:0:0: [sdb] CDB:
[ 6923.811715] Read(10): 28 00 1e ec 27 08 00 00 f0 00
[ 6923.811723] end_request: I/O error, dev sdb, sector 518792968
[ 6924.066187] usb 3-2: new high-speed USB device number 29 using xhci_hcd
[ 6924.084065] usb 3-2: New USB device found, idVendor=05e3, idProduct=0718
[ 6924.084075] usb 3-2: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[ 6924.084081] usb 3-2: Product: USB Storage
[ 6924.084085] usb 3-2: SerialNumber: 000000000033
[ 6924.084847] usb-storage 3-2:1.0: USB Mass Storage device detected
[ 6924.085081] scsi28 : usb-storage 3-2:1.0
[ 6945.847454] usb 3-2: reset high-speed USB device number 29 using xhci_hcd
[ 6945.864597] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff88017f9a1680
[ 6945.864608] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ffff88017f9a16c0
[ 6956.496837] usb 3-2: USB disconnect, device number 29
[ 6956.799664] usb 3-2: new high-speed USB device number 30 using xhci_hcd
[ 6956.817743] usb 3-2: New USB device found, idVendor=05e3, idProduct=0718
[ 6956.817754] usb 3-2: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[ 6956.817759] usb 3-2: Product: USB Storage
[ 6956.817763] usb 3-2: SerialNumber: 000000000033
[ 6956.818457] usb-storage 3-2:1.0: USB Mass Storage device detected
[ 6956.818590] scsi29 : usb-storage 3-2:1.0
我不知道从何开始,但无论怎样做都会非常感激。
附言:我在驱动器前面放了一个重型风扇,以防止它过热,以防万一
答案1
USB 适配器通常很差劲。你最好在本地连接。如果这显然不是一个选择,那么我们需要解决方法驱动器不可靠
这里我考虑采用两种不同的方法,两种方法都假设驱动器不可靠。
首先使用 gnu ddrescue(而不是其他较旧的 ddrescue)进行完整的驱动器备份。
使用日志文件
这样,它会从停止的地方继续备份。它还会在下一次备份中修复任何损坏。在 kpartx 中安装已拯救的驱动器并进行文件级备份。
第二种方法是使用 rsync 进行文件级别的复制 - 我不记得具体的设置,但我相信 -r 表示递归,-P 表示保留部分文件是必要的。
这两种方法都应该可以正常工作,但效果不如使用已知良好的电缆将驱动器直接插入适当的本机接口。