Shutdown script for HDD eject?

Hello there

I’ve successfully included a 2.5" HDD to the Pi 2 and it seems to be working OK being mounted and read normally.

I do have a question regarding the HDD health. Whenever I use the shutdown command I can hear the HDD plates spinning down after the Pi shuts down. However, whenever connect the same drive to a laptop (Mac OSX) and eject the drive before pulling the USB cable no such sound is heard. It seems that when ejecting the drive from the laptop the HDD plates stop spinning normally. When executing the shutdown -h now command in the Pi the HDD plates seem to abruptly stop as if I had just pulled the USB cable without the shutdown command.

Running sudo hdparm -Y /dev/sda before shutting down the Pi seems to do the trick.

Question: how can I include the sudo hdparm -Y /dev/sda command in the shutdown script of the OSMC Shutdown button?

Anyone? I had created my own shutdown script in init.d with symlinks in rc0.d but no joy.

I even tried to create a log file from the script in this tutorial but no file was created in /var/log.

http://ubuntu.flowconsult.at/linux/ubuntu-14-10-rc-local-rc0-d-debugging-test-scripts/

What’s going on with the shutdown scripts?

This has likely been solved somewhere else but having finally gotten around to connecting a USB HDD to my OSMC Pi and marvelling at how neat it is, the noise from the HDD when I power-off from OSMC is “interesting” and sounds alarmingly abrupt.

The HDD is powered directly from the Pi 3 via a USB cable with no further external power supply. I have an official 2.5A supply. I haven’t usb_max_current since I’ve read that this does nothing on the 3.

Like the poster above, I’m wondering how to gently shutdown the HDD before the Pi and directly as a result of the OSMC power-off. Any help or re-direction would be appreciated as I’ve been searching here and the Pi.org forum without any success.

Yeah was looking for solution for this also.

The sudden loud click of hard drive when shutting down doesn’t sound good for parking heads.

Also if the hard drive is in standby and shutdown is executed the hard drive will start to spin up but suddenly lose power as pi is shutdown causing loud click of parking heads.

Wonder would issuing hdparm on shutdown help this.