Attached hard drive no longer spins down

I have recently updated my FreedomBox and am now running 6.1.0-10-armmp-lpae with all packages up to date. I normally use this server to do some backups, view old photos from an external hard drive, etc. With the latest updates I have noticed that my external hard drive no longer spins down and is rather warm to the touch constantly. In the past it used to spin down after some minutes of not being used.

The hard drive is auto mounted on the FreedomBox whenever it is plugged in. I have not changed any details. It is a Seagate 1K9AP6-501 2TB drive, if that matters.

I have attempted to use hdparm to force it to spin down but that did not work.

Any ideas appreciated.

Thanksā€¦Larry

1 Like

Manual reference for hdparm (or you can do man hdparm from the command line.)
Manual reference for hdparm.conf (or you can do man hdparm.conf from the command line)
Configuration reference: read the /etc/hdparm.conf file which contains examples in the comments
You may need to install the hdparm package: apt install hdparm

Iā€™ll share some things you can try. I recommend you first try getting the result you like using only the -B or apm=nnn option I show you below. If you canā€™t suit yourself using -B then try adding in the -S or spindown_time=nnn alternative. I assume that your external drive has the /dev name of /dev/sdb for these examples.

# this will set the apm (Advanced Power Management) setting to maximum power savings without spindown. I use this on a server to frequent cycling wear but still save some power

$sudo hdparm -B 128 /dev/sdb

# this will set the apm to maximum apm power saving which includes the use of spindown
$sudo hdparm -B 1 /dev/sdb

# you can pick an apm value between 1 and 127 to save power and spin down with 1 giving the most power saving and 127 giving the least power saving which include spindown. The hdparm manual page does not specify the differences between values in the 1 - 127 range. Try to find one you like.
$sudo hdparm -B 92 /dev/sdb

You can use the -S option to hdparm to set spindown options. Hereā€™s what the manual says:

-S Put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive. This timeout value is used by the drive to determine how long to wait (with no disk acā€
tivity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are
much quicker. The encoding of the timeout value is somewhat peculiar. A value of zero means ā€œtimeouts are disabledā€: the device will not automatically enter standby mode. Values from 1 to
240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5
hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21
minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.

I would start on the conservative side here because the power cycles will accumulate as wear on the device.

# use vendor defined timeout period (maybe between 8-12 hours)
$sudo hdparm -S 253 /dev/sdb

# use 21 minutes which is about the maximum you can specify
$sudo hdparm -S 252 /dev/sdb

When you get these set up as you wish, you can persist this in the /etc/hdparm.conf file. You would edit this file as root (or using sudo) and add the following lines in the section of the file which has these options:

apm=92
spindown_time=252

Once you modify /etc/hdparm.conf such as that these settings are applied at reboot. This may take a bit more work to make this apply to a hotplug USB drive. The /etc/hdparm.conf file contains examples how to apply the hdparm settings to a specific device which may be what you need for the external USB device.

Hi.

Is your requirement to spin-down the disk to safely unmount and remove it?

If so, the below may be more practical.

udisksctl power-off -b /dev/sdX

modify sdX for your drive

Thank you for the responses. I worked on this problem for many hours: trying a number of tools such as hdparm, hd-idle - neither of which worked properly with the recent version of the FreedomBox update- specifically 6.1.0-10-armmp-lpae . I even tried a number of different drives - Seagate and others. Same problem - would never spin down. I even tried to change some /etc/fstab settings, to no avail.

I started some reading about my problem and came across some rather old posts about the ext4 filesystem (which is what I have on those drives) and some kernel versions causing them to never spin down.

As an experiment I reformatted one of the drives to ext3 rather than ext4 and it worked as it should - the drive spins down after about 5 minutes of non-use! Thatā€™s good enough for me and is the filesystem I am now going to use with my external drive.

2 Likes

Thanks for coming back and reporting what solution you found.