Posts by doragasu

    More tests, with old USB boxes I had lying around:

    • Old Zaapa USB box, enumerated as: "04fc:0c25 Sunplus Technology Co., Ltd SATALink SPIF225A". Same behaviour as the first one. Hdparm fails and udisksctl successfully powers the disk down.
    • Old Conceptronic USB box, enumerated as: "152d:2329 JMicron Technology Corp. / JMicron USA Technology Corp. JM20329 SATA Bridge". It looks like it tries to respect hdparm, but something goes wrong: when the timeout occurs, the disk continues spinning, but dmesg shows a bunch of USB errors... udisksctl works.
    • Old i-Joy USB box enumerated as: "152d:2339 JMicron Technology Corp. / JMicron USA Technology Corp. JM20339 SATA Bridge" (almost the same as the Conceptronic one above, but dev id changes from 2329 to 2339). It works!!! Both hdparm and udisksctl work as intended!
    • Old 2.5" Iomega USB Box model SPHDU, enumerated as: "059b:047a Iomega Corp. Select Portable Hard Drive". It works!!! Both hdparm and udisksctl.

    So far I have tested 7 enclosures and only 2 worked... And the two working were old ones. If now I want to buy a new enclosure, how can I make sure it supports this feature?

    Did tests on two more external USB disks I have:

    • 500 GB Western Digital 2.5" WDBPCK5000ABK-01: Exactly the same results that I had with the Seagate drive above. udisksctl can power the drive down, but hdparm shows the same behavior.
    • 2TB TooQ TQE-3527B: This one is weird: hdparm does not error, but I wait and disk is never powered down. udisksctl seems to power the drive down (the LED goes off and the drive gets disconnected) but in fact the disk continues spinning, never stops. Even removing the USB cable does not stop the drive (all other enclosures stop it). Pretty crappy USB enclosure.

    Hum, I didn't see -S switch, thanks for the suggestion. I have tested "hdparm -S 3" (should be 15 seconds wait) in on my PC with the USB drive. Spolier: didn't work:

    • Normal user and /dev/sdi1: Fails with "HDIO_DRIVE_CMD(setidle) failed: Inappropriate ioctl for device". When tested, dmesg shows: "hdparm: sending ioctl 2285 to a partition!"
    • Normal user and /dev/sdi: Fails with same error message as above (dmesg shows nothing).
    • root and /dev/sdi1: Fails with "SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" (dmesg shows nothing).
    • root and /dev/sdi: Fails with same message as above.

    Tried also on a regular disk of the machine (/dev/sdb) and it looks like it worked...

    I have googled a bit more, and reading here and here, it looks like the problem must be the controller of the USB enclosure. The enclosure is a "Seagate 1D7AD7-500 3TB". Too bad if this is the case :(

    I have unplugged the disk from my LE powered Pi, and plugged it to my PC, to do some more tests, and now I am even more confused.

    As happened on the Pi, I can get the disk to suspend neither configuring autosuspend, nor unbinding it. Hdparm also does not help. Gives a more verbose error, with some hexadecimal numbers I do not understand.

    But using "udisksctl power-off -b /dev/sdx" (with x corresponding to the USB disks) effectively powers the disk down! When doing this, also dmesg shows the following message just before the disk goes down:

    Code
    WARNING! power/level is deprecated; use power/control instead

    So it looks like udisksctl is writing a magic word to the power/level sysfs file to shut down the disk. What is it writing? no idea. I have tried off, shutdown, shut-down, poweroff, power-off, powerdown, power-down without success.

    There is also an additional problem... If I manage to shut down the disk using this method, I do not know how to power it on again without having to unplug/plug the USB cable or power brick... The disk disappears from the devices listed by lsusb and /sys/bus/usb/devices, and also trying to unbind/bind the hub to which the disk is plugged does not make it wake (By the way it also looks like unbinding the hub does not work properly because not all the devices plugged to it disappear).

    So, could it be possible that the disk supports power-off but does not support suspend/sleep? How can I shut it down without using udisksctl? And after shutting it down, is there a way to wake it up?

    Thanks for the prompt reply! Unfortunately that didn't work:

    I have also seen that there is a utility called udisksctl that works for some people when hdparm fails. Unfortunately it looks like udisksctl is not available on LE.

    I have LE installed on an RPi, and I'm pretty happy with it... except for an issue with an USB disk.

    LE boots from the SD, and as the power usage of the Pi when idle is low, I leave it always on. But I would like USB disks to suspend when unused: to save power (a 3.5" disk typically drains more power than the Pi) and to enhance disk lifetime. But I cannot get the USB disk to suspend unless I shut down the Pi. I have been reading kernel documentation here and also some more info on this topic for example here and here. And although information from some sources seem to contradict others, I think that I should be able to enable autosuspend after 5 minutes of inactivity with the following sequence (after doing ssh to LE):

    Code
    $ cd /sys/bus/usb/devices/<usb-device>/power
    $ echo auto > control
    $ echo 300 > autosuspend
    $ echo 300000 > autosuspend_delay_ms

    Some notes:

    • <usb-device> must be replaced with the device identifier of the disk. I obtain it using lsusb and lsusb -t as shown here.
    • control (and level) were set to "on", and are changed to "auto" after running the commands above.
    • autosuspend was set to "-1" and is changed to "300" after running the commands.
    • autosuspend_delay_ms was set to "-1000" and is changed to "300000" after running the commands.

    But this approach does not work. Neither works unbinding the disk as shown here. I'm suspecting that maybe the USB disk does not support suspending, but that doesn't look like the case, because when I shut down the Pi, the disk shuts down (even though it is still powered). Also it looks like the driver never suspends the disk, because if I poll

    So right now I'm out of ideas. Is autosuspend supported? What can I try?

    I have a RPi 1 running OpenElec 6. I want to update to latest LibreElec, so I have downloaded the .tar file for updating (LibreELEC-RPi.arm-8.0.1.tar), checked the download is OK using sha256sum, uploaded the file to the Update share, rebooted, and blam!, does not work:

    Checking size: FAILED

    I have tried two times the update procedure, copying the .tar file to the Update share, and I get the same result. I have also tried two more times by copying the file locally, by mounting the SD card on my PC and copying the file to the .update directory of the Storage partition. Same result. By the way, the Storage partition on the SD card has 11.7 GB free.

    What is causing this problem? How can I fix it?