所以我买了一个 Seagate 外置 USB 存储,它在 90 分钟后进入睡眠状态。它的所有电源都来自 USB。
在 dmesg 中,发生了以下情况:
[Dom Jun 29 17:25:08 2014] sd 7:0:0:0: Attached scsi generic sg4 type 0
...
[Dom Jun 29 19:06:48 2014] sd 7:0:0:0: Device offlined - not ready after error recovery
不管这意味着什么,如果我拔下电源插头再插回去,它就能正常工作。
有几种答案谈到sdparm
如何hdparm
保持驱动器处于唤醒状态。
我正在寻找的是如何让它在 15 分钟未使用后进入睡眠状态,以及如何在不重新插入 USB 电缆的情况下将其唤醒?
当它“离线”时,就会/dev/sde
消失;并且其条目也会lsusb
消失。
dmesg 日志;我把我认为相关的一切都放进去了;我看到很多错误和问题;现在我不确定它是否真的要睡觉了?另外,我还使用了 2 米长的 USB 电缆。
dmesg -T |grep "sde\|7:0:0:0\|8-2:"
[Seg Jun 30 15:02:09 2014] usb 8-2: new high-speed USB device number 2 using xhci_hcd
[Seg Jun 30 15:02:09 2014] usb 8-2: New USB device found, idVendor=0bc2, idProduct=2300
[Seg Jun 30 15:02:09 2014] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Seg Jun 30 15:02:09 2014] usb 8-2: Product: Portable
[Seg Jun 30 15:02:09 2014] usb 8-2: Manufacturer: Seagate
[Seg Jun 30 15:02:09 2014] usb-storage 8-2:1.0: USB Mass Storage device detected
[Seg Jun 30 15:02:09 2014] usb-storage 8-2:1.0: Quirks match for vid 0bc2 pid 2300: 200000
[Seg Jun 30 15:02:09 2014] scsi7 : usb-storage 8-2:1.0
[Seg Jun 30 15:02:10 2014] scsi 7:0:0:0: Direct-Access Seagate Portable 0130 PQ: 0 ANSI: 4
[Seg Jun 30 15:02:10 2014] sd 7:0:0:0: Attached scsi generic sg4 type 0
[Seg Jun 30 15:02:10 2014] sd 7:0:0:0: [sde] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[Seg Jun 30 15:02:10 2014] sd 7:0:0:0: [sde] Write Protect is off
[Seg Jun 30 15:02:10 2014] sd 7:0:0:0: [sde] Mode Sense: 2f 08 00 00
[Seg Jun 30 15:02:10 2014] sd 7:0:0:0: [sde] No Caching mode page found
[Seg Jun 30 15:02:10 2014] sd 7:0:0:0: [sde] Assuming drive cache: write back
[Seg Jun 30 15:02:10 2014] sde: sde1 sde3
[Seg Jun 30 15:02:10 2014] sd 7:0:0:0: [sde] Attached SCSI disk
[Seg Jun 30 15:02:54 2014] FAT-fs (sde1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[Seg Jun 30 15:02:54 2014] EXT4-fs (sde3): mounted filesystem with ordered data mode. Opts: (null)
[Seg Jun 30 15:24:51 2014] sd 7:0:0:0: Device offlined - not ready after error recovery
[Seg Jun 30 15:24:51 2014] sd 7:0:0:0: [sde] Unhandled error code
[Seg Jun 30 15:24:51 2014] sd 7:0:0:0: [sde]
[Seg Jun 30 15:24:51 2014] usb 8-2: USB disconnect, device number 2
[Seg Jun 30 15:24:51 2014] sd 7:0:0:0: [sde] CDB:
[Seg Jun 30 15:24:51 2014] end_request: I/O error, dev sde, sector 1100056568
[Seg Jun 30 15:24:51 2014] EXT4-fs warning (device sde3): __ext4_read_dirblock:908: error reading directory block (ino 33032637, block 0)
[Seg Jun 30 15:24:51 2014] end_request: I/O error, dev sde, sector 0
[Seg Jun 30 15:24:51 2014] sd 7:0:0:0: [sde] Synchronizing SCSI cache
[Seg Jun 30 15:24:51 2014] sd 7:0:0:0: [sde]
[Seg Jun 30 15:24:51 2014] Buffer I/O error on device sde3, logical block 119046144
[Seg Jun 30 15:24:51 2014] lost page write due to I/O error on sde3
[Seg Jun 30 15:24:51 2014] JBD2: Error -5 detected when updating journal superblock for sde3-8.
但使用后fsck
,问题减少了:现在,在保持 sde3 卸载 10 小时后,如果我尝试安装它,它不会出现任何错误!但如果我忘记安装它,一段时间后它就会进入睡眠状态(?),然后,如果我尝试访问它,我会收到一些错误,它会被卸载,它似乎重新启动但失败了,然后我被迫重新连接 USB 电缆...所以问题似乎仍然与进入睡眠状态有关?不确定,我需要做更多的测试,但我认为如果一段时间内(在睡眠时间之前)没有活动,它应该会自动卸载,以防止重新连接 USB 问题。
答案1
您的日志中仍然没有明显的错误,除了 CDB 错误,然而,该错误发生在阻塞磁盘的错误恢复之后。所以我建议您安装智能工具然后运行智能控制在您的磁盘上。您应该运行扩展测试,这是最有帮助的,
sudo smartctl -t log /dev/sde
如果你想估计一下你能跑多久,这将需要一些时间
sudo smartctl -c /dev/sde
前第一个命令,它会告诉您需要多长时间。
很明显,您的磁盘离线不是由于睡眠命令的结果,而是因为不可恢复的错误。smartctl 将帮助您找到磁盘上的所有错误,我们已经确信其中有很多。