USB HDD always spin down after few minutes

  • Hi.

    I'm using version 13 night builds on my GMKtec G3 Plus (version 12 doesn's work on my box).

    I have an USB hard drive connected via USB and have no problem in general but when I pause a movie or anything I'm watching for just few minutes, HDD spins down.

    I tried to use hdparm in autostart.sh with this command: "hdparm -S 0 /dev/sda2" and also "/usr/bin/hdparm -S /dev/sda2" but with no luck: if I pause my watching, HDD spins down, always.

    If I open a shell (ssh) and run the command "hdparm -S 0 /dev/sda2" when HDD is down then it resumes so, I guess, the command is correct but when inserted in autostart.sh it doesn't work.

    If I shutdown LibreElec keeping HDD on it never spins down so I guess it's LibreElec that somehow spins HDD down in some way.

    What am I doing wrong? Is there anything else I can do to avoid the spinning down of my HDD after few minutes?

    Thanks a lot,

    Michele.

    Edited 2 times, last by myksto (July 7, 2025 at 4:20 PM).

  • Update the script to use /dev/sda and see if that resolves the issue? - the hdparm command targets a disk device and /dev/sda2 is a partition on a disk, not the disk.

  • I'll give it a try late in the evening.

    The thing that looks stange to me is the fact that if I lunch the command "hdparm -S 0 /dev/sda2" from an SSH shell when the HDD is sleeping then it start to spin up immediately.

    Thanks a lot for your advice.

  • Not working, modified script in "hdparm -S 0 /dev/sda", rebooted and after few minutes HDD spins down.

    I noted one thing, if I launch the command "hdparm -S 0 /dev/sda" from an SSH shell HDD spins UP and "Setting StanBy to 0 (off)" appears on console but after few minutes HDD spins down again.

    I really don't undestand what's going on. This is the third HDD I try and with all of them I have the same result. This must something inside LibreElec or its operative system.

    Any other idea?

  • I have an USB hard drive connected via USB and have no problem in general but when I pause a movie or anything I'm watching for just few minutes, HDD spins down.

    Most users prefer that behavior. So in general it's not a bug, but a feature. :saint:

    I tried to use hdparm in autostart.sh with this command: "hdparm -S 0 /dev/sda2" and also "/usr/bin/hdparm -S /dev/sda2" but with no luck: if I pause my watching, HDD spins down, always.

    The thing that looks stange to me is the fact that if I lunch the command "hdparm -S 0 /dev/sda2" from an SSH shell when the HDD is sleeping then it start to spin up immediately.

    The above facts result in the conclusion that your HDD firmware does the energy management, not LE.

    • The HDD firmware spins down whenever idle in mounted mode.
    • The HDD firmware takes hdparm as an abstract task, and spins up without further command interpretation.
  • Hi and thanks for your reply.

    Quote

    So in general it's not a bug, but a feature. :saint:

    I can in general agree with you but the fact that HDD spins down after 2-3 minutes as soon as I pause a movie it's not a feature but an annoyance, at least for me. It would be different if HDD would stop after say 10 or more minutes.

    Quote

    The above facts result in the conclusion that your HDD firmware does the energy management, not LE.

    • The HDD firmware spins down whenever idle in mounted mode.
    • The HDD firmware takes hdparm as an abstract task, and spins up without further command interpretation.

    I would not be so sure of that. If it's the firmware that spins down the HDD, why that firmware does not spin HDD down when LibreElec is off?

    Then I don't event think it's not a HDD type matter because I tried with 3 different HDD (and one of them is very very old): the behavouir is the same for all.

    Anyway, if hdparm does not seem to be working, what else I can do to control my HDD power management with LibreElec?

    Thanks a lot, Michele.

    Edited 3 times, last by myksto (July 9, 2025 at 9:35 AM).

  • I tried to use hdparm in autostart.sh with this command: "hdparm -S 0 /dev/sda2" and also "/usr/bin/hdparm -S /dev/sda2" but with no luck: if I pause my watching, HDD spins down, always.

    The first example should fail because the script is not providing the full path to hdparm and is addressing a partition not a disk.

    The second example should fail because the script is providing an incorrect path to hdparm and addressing a partition not a disk.

    Even if you corrected to /dev/sda as per my previous suggestion, you're still going to fail on the first points above.

    The correct path is /usr/sbin/hdparm not /usr/bin/hdparm

  • The first example should fail because the script is not providing the full path to hdparm and is addressing a partition not a disk.

    The second example should fail because the script is providing an incorrect path to hdparm and addressing a partition not a disk.

    Even if you corrected to /dev/sda as per my previous suggestion, you're still going to fail on the first points above.

    The correct path is /usr/sbin/hdparm not /usr/bin/hdparm

    I beg your pardon but it was my typo, the path I used is /usr/sbin/hdparm.

    Anyway I think the problem is not there.

    I wrote before:

    I noted one thing, if I launch the command "hdparm -S 0 /dev/sda" from an SSH shell, HDD spins UP and "Setting StandBy to 0 (off)" appears on console but after few minutes HDD spins down again.

    It seems hdparm can't manage HDD power management even when launched directly through shell