USB HDD standby - Can sdparm be added to the distro?

  • Hello,

    First of all thank you for the work on LibreELEC.

    I have few HDD attached via the USB interface to my Rock64. I would want to be able spin down all disks after some inactivity. Two disks spin down fine using the pre-installed hdparm. However, my 3rd disk (Segate) requires sdparm to spin it down (this disk has SCSI interface). As I understand for LibreELEC packages cannot be installed by the user.

    Can the sdparm be added to the distribution as well with your next release?

    Right now, my workaround is to run a docker debian container in privileged mode to be able to install sdparm and spin down the disk:

    Code
    sdparm --flexible -6 -l --save --set SCT=54000 /dev/sdb
    sdparm --flexible -6 -l --save --set STANDBY=1 /dev/sdb

    (54000 * 0.1s) = 1.5h

    Docker:

    Code
    docker run --rm --privileged --device=/dev/sda:/dev/sda -it arm64v8/debian
    
    apt-get update
    apt-get install sdparm -y

    Version:

    Code
    Linux Rock64 4.4.103 #1 SMP Fri Dec 22 08:22:26 CET 2017 aarch64 GNU/Linux
  • zarusz or anyone finding this through search engine. I bought a Seagate HDD which needs sdparm. With the above, I managed to optimise to one command:

    Code
    docker run --rm --privileged --device=/dev/sda:/dev/sda arm64v8/debian /bin/bash -xec 'apt-get update && apt-get install sdparm -y && sdparm --flexible -6 -l --save --set STANDBY=1 /dev/sda && sdparm --flexible -6 -v -S -p po --set=SCT=9000 /dev/sda'
  • I'd see if you can can simply copy the binary from the container to /storage and run from there. It's never guaranteed, but simple binaries without heavy runtime dependencies can often be copied over from e.g. Rasberry Pi OS to an LE install. If it works, use autostart.sh to add the binaries /storage/location to $PATH at boot time and you can avoid the complication of docker.

  • joop

    I wonder if hdparm could help here putting the drive into sleep mode

    - I couldn't exactly get what you're also doing with drive, though -

    I esp. mean the hdparm parameter "-K",

    see:

    hdparm(8) - Linux manual page

    -K

    "... retain the settings for -APSWXZ over a soft reset ..."

    "soft reset" := reboot ?

    -S

    "Put the drive into idle (low-power) mode ..."

  • chewitt Thanks for the tip and response, I didn't realize/think of pulling binaries from raspberryOS... that's worth trying out. I actually run docker-compose as a bin as well... I'll post here if successful.. for now it's running - albeit a bit over engineered.

    GDPR-7 Thanks for the suggestion. Unfortunately hdparm doesn't work on this type/brand of disk. (Western Digital)... wish I bought Seagate like I did before.

  • me is confused, that your disk doesn't support hdparm.

    from a newer WD disk (WD-Black-P10) made years later as yours.

    I haven't tried to set power feature, though.

    anyway my mom owns a 1 TB of your disk type and I'll check hdparm support next time I get my fingers on the disk (700 km away)

    sudo hdparm -I /dev/sdX:

    ATA device, with non-removable media

    Model Number: WDC WD50NMZW-59A8NS1

    Serial Number: WD-WX92E317FZUN

    Firmware Revision: 01.01A01

    Transport: Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0

    Standards:

    Used: unknown (minor revision code 0x006d)

    Supported: 10 9 8 7 6 5

    Likely used: 10

    Configuration:

    Logical max current

    cylinders 16383 0

    heads 16 0

    sectors/track 63 0

    --

    LBA user addressable sectors: 268435455

    LBA48 user addressable sectors: 9767475632

    Logical Sector size: 512 bytes

    Physical Sector size: 4096 bytes

    Logical Sector-0 offset: 0 bytes

    device size with M = 1024*1024: 4769275 MBytes

    device size with M = 1000*1000: 5000947 MBytes (5000 GB)

    cache/buffer size = unknown

    Form Factor: 2.5 inch

    Nominal Media Rotation Rate: 5400

    Capabilities:

    LBA, IORDY(can be disabled)

    Queue depth: 32

    Standby timer values: spec'd by Standard, with device specific minimum

    R/W multiple sector transfer: Max = 16 Current = 0

    Advanced power management level: 128

    DMA: *mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 udma6

    Cycle time: min=120ns recommended=120ns

    PIO: pio0 pio1 pio2 pio3 pio4

    Cycle time: no flow control=120ns IORDY flow control=120ns

    Commands/features:

    Enabled Supported:

    * SMART feature set

    Security Mode feature set

    * Power Management feature set

    * Write cache

    * Look-ahead

    * WRITE_BUFFER command

    * READ_BUFFER command

    * NOP cmd

    * DOWNLOAD_MICROCODE

    * Advanced Power Management feature set

    Power-Up In Standby feature set

    * SET_FEATURES required to spinup after power up

    * 48-bit Address feature set

    * Mandatory FLUSH_CACHE

    * FLUSH_CACHE_EXT

    * SMART error logging

    * SMART self-test

    * General Purpose Logging feature set

    * 64-bit World wide name

    * IDLE_IMMEDIATE with UNLOAD

    * {READ,WRITE}_DMA_EXT_GPL commands

    * Segmented DOWNLOAD_MICROCODE

    * Gen1 signaling speed (1.5Gb/s)

    * Gen2 signaling speed (3.0Gb/s)

    * Gen3 signaling speed (6.0Gb/s)

    * Native Command Queueing (NCQ)

    * Phy event counters

    * Idle-Unload when NCQ is active

    * NCQ priority information

    * READ_LOG_DMA_EXT equivalent to READ_LOG_EXT

    DMA Setup Auto-Activate optimization

    Software settings preservation

    * SMART Command Transport (SCT) feature set

    * SCT Write Same (AC2)

    * SCT Features Control (AC4)

    * SCT Data Tables (AC5)

    unknown 206[7]

    unknown 206[12] (vendor specific)

    unknown 206[13] (vendor specific)

    * DOWNLOAD MICROCODE DMA command

    * WRITE BUFFER DMA command

    * READ BUFFER DMA command

    * Data Set Management TRIM supported (limit 255 blocks)

    * Deterministic read data after TRIM

    Security:

    Master password revision code = 65534

    supported

    not enabled

    not locked

    not frozen

    not expired: security count

    supported: enhanced erase

    886min for SECURITY ERASE UNIT. 886min for ENHANCED SECURITY ERASE UNIT.

    Logical Unit WWN Device Identifier: 50014ee2697f04ff

    NAA : 5

    IEEE OUI : 0014ee

    Unique ID : 2697f04ff

    Checksum: correct

  • Can the sdparm be added to the distribution as well with your next release?

    seems it is added:

    [le10] Update system-tools to addon (130) by heitbaum · Pull Request #6561 · LibreELEC/LibreELEC.tv
    Backport of #6560 Packages bottom: update to 0.6.8 efivar: update to 38 evtest: update to 1.35 htop: update to 3.2.1 inotify-tools: update to 3.22.1.0 mc:…
    github.com

    I guess you'll get it with the next nightly

    +++Edit+++

    and if so and you're satisfied please mark this thread as resolved (see just under the thread title)

    Edited once, last by GDPR-7: additions (June 4, 2022 at 2:15 AM).

  • WOW! That's really cool. Thanks to everyone advising! Happy to use it once it lands in stable. Keep up the good work, I'm grateful.

    I believe @zarusz is the one to mark as resolved?