Graceful way to spin down (unload head) USB attached mobile hard drive BEFORE shutdown(poweroff/reboot/halt)

That’s right. It’s an old issue.
I’m not familar with linux kernel dev,
Maybe manually turn off the usb disk is right solution and it’s the creed for geek linux user.
But it will be really disappointing when I found my usb HDD broken because of this.

Related Doc:

http://www.linux-ata.org/shutdown.html

https://bugzilla.kernel.org/show_bug.cgi?id=205107

Solutions:

  1. add a udev rule
/etc/udev/rules.d/01-manage_start_stop.rules

ACTION=="add|change", DRIVERS=="usb-storage|uas", SUBSYSTEM=="scsi_disk", ATTR{manage_start_stop}="1"
  1. do it Manually (do it as super user)
find /sys -name manage_start_stop
echo 1 > /sys/class/scsi_disk/h:c:i:l/manage_start_stop
("h:c:i:l" replace to what you saw above)