So I got a Seagate external usb storage that goes to sleep after 90 minutes. All its power comes from the usb.
At dmesg, this is what happens:
[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
Whatever that may mean, if I unplug and plug back it works fine.
There are several answers speaking about sdparm
and hdparm
to keep the drive awake.
What I am looking for is how to make it go sleep after 15 minutes without being used, and how to wake it up back without re-plugging the usb cable?
When it gets "offlined", the /dev/sde
vanishes; and its entry at lsusb
vanishes too.
The dmesg log; I put everything I think is related; I see many errors and problems; now I am not sure it is actually going to sleep? also I am using a 2m long usb cable.
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.
But after using fsck
, the problem diminished: now, after 10h keeping sde3 unmounted, if I try to mount it, it gives no errors! But if I forget it mounted, after some time it goes to sleep (?) and then, if I try to access it, I get some errors, it gets unmounted, it seems to restart but fail and then I am forced to reconnect the usb cable... so the problem still seems related to going sleep? not sure tho, I need to do more tests, but I think it should auto unmount if there is no activity for some time (before the sleep time), to prevent the reconnect usb problem.
dmesg |grep uas -i
returned nothing