Raspberry pi stop disk spin down

Jim azanorak at gmail.com
Sun Nov 28 18:57:12 MST 2021


Thanks.  I'll look into this.  If I can't get it to make the disk stay 
spinning, I can always use a cron job to access a small text file every 
5 or 10 minutes.

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 at 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 at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> https://lists.phxlinux.org/mailman/listinfo/plug-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20211128/f9ffc147/attachment.html>


More information about the PLUG-discuss mailing list