Page 1 of 1

External hard drives that no longer standby under rasbian buster

Posted: Sat Oct 19, 2019 7:16 pm
by Gilder
Good evening, I use a RPI 3b+ like nas with 3 hard drives connected in USB and where each disc is in a box which is supposed to extinguish automatically the disc after 10 minutes of inactivity. Everything worked well before, but since the passage to raspian 10, it does not seem to work, and I hear all the time the discs turn any time of the day. An idea of how to solve that?
Even when I dismount a disc, it does not go to sleep
IMG_20190929_180611.jpg
IMG_20190929_180611.jpg (61.04 KiB) Viewed 818 times

Re: External hard drives that no longer standby under rasbian buster

Posted: Sat Oct 19, 2019 8:42 pm
by epoch1970
Gilder wrote:
Sat Oct 19, 2019 7:16 pm
Even when I dismount a disc, it does not go to sleep
Did you check with the "mount" command that the device is not mounted still?
Your OS is running off the SD, or one of the drives?

Re: External hard drives that no longer standby under rasbian buster

Posted: Sat Oct 19, 2019 9:04 pm
by Gilder
you can look at the result of the command "mount" and "lsblk" . And yes , raspbian is installed on the SD card
mount.jpg
mount.jpg (101.42 KiB) Viewed 768 times
lsblk.jpg
lsblk.jpg (50.95 KiB) Viewed 768 times

Re: External hard drives that no longer standby under rasbian buster

Posted: Sat Oct 19, 2019 10:20 pm
by andrum99

Code: Select all

sudo apt update && sudo apt install hdparm
sudo hdparm -q -S 120 -y /dev/sda
You can also put calls to hdparm in /etc/rc.local to set the standby timeout at boot - works for me. See 'man hdparm' for details.

Re: External hard drives that no longer standby under rasbian buster

Posted: Sat Oct 19, 2019 10:22 pm
by Kendek
If installed, hdparm automatically sets the APM level to 254 on all HDDs by default, and there is no spin-down from value 128.
You can edit the /etc/hdparm.conf, just uncomment the spindown_time line, and set value to 120, which is 10 minutes.

You can test it with the following command:

Code: Select all

sudo DEVNAME=/dev/sda /lib/udev/hdparm

Re: External hard drives that no longer standby under rasbian buster

Posted: Sun Oct 20, 2019 11:44 am
by Gilder
Kendek wrote:
Sat Oct 19, 2019 10:22 pm
If installed, hdparm automatically sets the APM level to 254 on all HDDs by default, and there is no spin-down from value 128.
You can edit the /etc/hdparm.conf, just uncomment the spindown_time line, and set value to 120, which is 10 minutes.

You can test it with the following command:

Code: Select all

sudo DEVNAME=/dev/sda /lib/udev/hdparm

I did that and now it works. But why 120 = 10 minutes? what is this 120?

Re: External hard drives that no longer standby under rasbian buster

Posted: Sun Oct 20, 2019 11:51 am
by Kendek
Gilder wrote:
Sun Oct 20, 2019 11:44 am
I did that and now it works. But why 120 = 10 minutes? what is this 120?
You are welcome. Values from 1 to 240 specify multiples of 5 seconds, so 120 x 5 = 600 seconds, which is 10 minutes.

Re: External hard drives that no longer standby under rasbian buster

Posted: Sun Oct 20, 2019 3:48 pm
by andrum99
Kendek wrote:
Sun Oct 20, 2019 11:51 am
Gilder wrote:
Sun Oct 20, 2019 11:44 am
I did that and now it works. But why 120 = 10 minutes? what is this 120?
You are welcome. Values from 1 to 240 specify multiples of 5 seconds, so 120 x 5 = 600 seconds, which is 10 minutes.
Yup - It's explained in the man page for hdparm. I'm guessing it has to do with the way the timeout is encoded in the hard drives themselves - they've used a single byte to represent the standby timeout setting - 0 to 255 - and some clever maths to enable this to specify values up to several hours.