Ubuntu Bionic - Power down USB HDD before shutdown

Hi Fellow Members,
@tsangyoujun, @hyphop - Sorry to be a bother :relaxed:

I need to automatically unmount and power down the USB HDD when I hit the hardware switch for shutdown.
dev/sda is the HDD and dev/sda1 is the mounted volume.
Environment is Ubuntu bionic on VIM3.

Can someone try it for themselves and then suggest foolproof steps. I am familiar with linux and will be able to follow the suggested steps. Thank you in advance!

Regards,
Prateek

its depend from kernel version

next topic for example how to

https://www.kernel.org/doc/html/v4.13/driver-api/usb/power-management.html