I tried smartctl.  It reported that the apm data was unavailable.  I couldn't get it to stay on, so I came up with a workaround.  I set up a cron job with two commands.  The first touches a file on that drive.  The second deletes it.  I set this for 10 minutes and it s eems to be working.

On 11/28/21 1:23 PM, AZ Pete via PLUG-discuss wrote:
Hi,
I have had the same problem with USB connected drives on my Pis, but I needed the reverse. Namely, I wanted them to spin down after some time. The bottom line is that since the hard drive is connected via USB, the USB hardware itself may prevent the drive from spinning down (or always shut it down). But, I've had some success using the smartmon tools package to control how/when a given hard drive will spin down. The package is called smartmon tools, but the command itself is smartctl. A few examples:
    sudo smartctl -a /dev/sda            - display all info about drive
    sudo smartctl -g all /dev/sda        - get all non-SMART settings (i.e. Advanced Power Mgmt setting)
    sudo smartctl --set=apm,127            - set Advanced Power Mgmt
    sudo smartctl --set=standby,241        - set standby timer to 30min (not sure if this superseded by apm setting)

    

A low value means aggressive power management and a high value means better performance. Possible settings range from values 1 through 127 (which permit spin-down), and values 128 through 254 (which do not permit spin-down). The highest degree of power management is attained with a setting of 1, and the highest I/O performance with a setting of 254. A value of 255  disables Advanced Power Management altogether on the drive (not all drives support disabling it, but most do).

You'll have to dig into the man pages and play around with the various APM settings to see if you can get things to work as you like.

If all else fails you could just set up a cron job which runs a script every minute that simply touches a file on the drive (i.e. touch /some_folder/some_dummy_file.txt), which should prevent it from spinning down.

Hope this helps.
Peter



On 11/27/2021 9:00 PM, Jim via PLUG-discuss wrote:
I have a hard drive attached via a USB adapter to my raspberry pi. The problem is that the disk always shuts down after a few minutes of inactivity.  When I want to access something on the disk or write to it, I have to wait for it to spin up.  How would I go about setting it so it doesn't spin down?  I tried to look online and found sdparm mentioned, but found nothing I could understand. Please help. Thanks
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss


---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss