Harddisk spin down on shutdown no longer works

Previously I enabled spinning down external USB disks on shutdown via the following udev rule:
ACTION=="add|change", DRIVERS=="usb-storage|uas", SUBSYSTEM=="scsi_disk", ATTR{manage_start_stop}="1"
(thanks to this thread)

This enabled automatic spin down for all usb drives on shutdown (by default it only powers off internal drives, no idea why though).

It has been working fine but only after latest stable updates (2023-11-06) the attribute manage_start_stop stopped being applied to the drive:

> cat /sys/devices/pci0000:00/0000:00:14.0/usb2/2-5/2-5.1/2-5.1:1.0/host8/target8:0:0/8:0:0:0/scsi_disk/8:0:0:0/manage_start_stop
0

(should be 1)

Any idea why this behaviour changed and how to adopt a fix?

1 Like

Unsure if you read this here

In Testing, there was this issue with spinning disks not spinning down. Some patch was made there but only few people reported it was fixed. I am sure this was fixed but I can not find it there?

Reply was (by @stephane ):

see this
https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.5.10

for
commit c031d9a8383d9898ee0051137b320fed75a55eed
Author: Damien Le Moal dlemoal@kernel.org
Date: Wed Oct 25 15:46:12 2023 +0900

scsi: sd: Introduce manage_shutdown device flag

commit 24eca2dce0f8d19db808c972b0281298d0bafe99 upstream.

I reckon that meant: “fixed”, but I feel noobish here…

Why did you define these udev rules in the first place? Were you on Testing branch then?

Yes, I’ve read all those threads, commit messages and mails. I’m running kernel 6.5.9 right now, the changelog above applies to kernel 6.5.10.

By default the linux kernel only spins down internel disks at shutdown. I also need to spin down all external drives to safely power them off. The udev rule is not associated to any bug or testing. Please see the linked topic in my first post.

That solution worked fine for a long time but now stopped (manage_start_stop attribute not applied to the external drives)

1 Like

Apparently manage_start_stop is now a read-only variable and to achieve the same result the attribute manage_system_start_stop has to be used instead.

This is the complete udev rule to make it work again like before:

ACTION=="add|change", DRIVERS=="usb-storage|uas", SUBSYSTEM=="scsi_disk", ATTR{manage_system_start_stop}="1"
2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.