Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


USB drive not going to sleep
#1
Hi guys,

As my NAS broke down I switched to using an external USB drive with my Moode Pi 3b+ setup and noticed the drive is always spinning. Shouldn't it spin down and go to sleep at some point? I'm a little worried about the drive's longevity if it doesn't go to sleep…

Any ideas or advice?
Reply
#2
(09-02-2020, 08:02 AM)Capso Wrote: Shouldn't it spin down

Not if it's mounted and active no
Reply
#3
(09-02-2020, 08:13 AM)vinnn Wrote:
(09-02-2020, 08:02 AM)Capso Wrote: Shouldn't it spin down

Not if it's mounted and active no

Well, obviously it is mounted. But not in use… I mean nothing is playing right now. My thought is that it should go to sleep like any drive would on any computer, after a period of 10 minutes of inactivity for instance. Or am I missing something?
Reply
#4
Spin down is controlled by the drive's internal SMART config.
You can probe and change the drive's SMART config on Linux with the 'smartctl' command, on your Pi you can install this by installing the smartmontools package, e.g.
Code:
sudo apt install smartmontools
Reply
#5
(09-02-2020, 08:23 AM)vinnn Wrote: Spin down is controlled by the drive's internal SMART config.
You can probe and change the drive's SMART config on Linux with the 'smartctl' command, on your Pi you can install this by installing the smartmontools package, e.g.
Code:
sudo apt install smartmontools

Thanks. Installed smartmontools and found my drive…

now how can I change it to go to sleep?

Looks like Smartmontools only probes… how to alter settings?
Reply
#6
Indeed I was wrong, that's what I get by relying on memory alone before I've had coffee. You can change some drive configuration with smartctl, just not spin down time, apologies.
Looks like a drive's spin down is set by using hdparm, installable on your Pi by installing the hdparm package.

Then with hdparm you can set the drive's spin-down in seconds with the S option, e.g.

Code:
sudo hdparm -S 600 /dev/sda

... assuming your USB disk is /dev/sda of course, to determine the device for your disk you can list block devices with lsblk.
Reply
#7
(09-02-2020, 12:26 PM)vinnn Wrote: Indeed I was wrong, that's what I get by relying on memory alone before I've had coffee. You can change some drive configuration with smartctl, just not spin down time, apologies.
Looks like a drive's spin down is set by using hdparm, installable on your Pi by installing the hdparm package.

Then with hdparm you can set the drive's spin-down in seconds with the S option, e.g.

Code:
sudo hdparm -S 600 /dev/sda

... assuming your USB disk is /dev/sda of course, to determine the device for your disk you can list block devices with lsblk.

THIS is the perfect solution! Worked like a charm. 

I used this to get the drive to sleep after 2 minutes:
Code:
sudo hdparm -S 24 /dev/sda2

Note that it is 5 seconds per unit… as mentioned here.

Quote:-S
Paramétrer le temps mort du stand-by de périphérique.

Usage :
  • 0 : désactive ; le périphérique ne rentrera pas en mode stand-by.
  • De 1 à 240 : spécifie des multiples de 5 secondes, avec des temps morts de 5 secondes à 20 minutes.
  • De 241 à 251 : spécifie de 1 à 11 unités de temps de 30 minutes chacune, avec des temps morts de 30 minutes à 5 h 30.
  • 252 : spécifie un temps mort de 21 minutes.
  • 253 : est une période de temps mort définie par le fabriquant, entre 8 à 12 heures.
  • 254 : réservée !
  • 255 : est interprétée comme 21 minutes plus 15 secondes.
Thanks a lot for your help vinnn!
Reply


Forum Jump: