Apple - Can I manually put an external hard disk to sleep?
Not an exact answer to your question, but when using Terminal.app there is an option to even further reduce hard disk sleep time from 10 minutes to 1 minute, with this command:
$ sudo pmset -a disksleep 1
On macOS, there's isn't a way to do so from the command line. To put your drives to sleep (aka spin down) you need to send an ATA command to the drive. This becomes problematic when trying to do this to USB drives because it would be dependent on what the USB to ATA bridge (controller in/on the USB enclosure/interface, not in the Mac) was capable of supporting (this is also why you can't reliably get SMART status from USB drives).
- In Linux, you can use the
hdparm -Y /dev/sdX
- In Windows, there is an app called RevoSleep
- BSD has the
atacontrol
andcamcontrol
utilities to send ATA commands - SpindownHD was a utility with Apple's CHUD tools, but it's last release was in 2006
Unfortunately, at current for macOS, there is nothing that allows sending ATA commands directly to drives. It would need to be embedded into something like diskutil
or a 3rd party app to get the functionality you are looking for. Though (IMO) it's unlikely because with the increasing prevalence of SSDs, there's really no more need to "spin down" a drive.
For more info, see this post on SuperUser: Ways to shut down/sleep and wake up hard drives on command?
Your best bet is to either eject the disk or set the sleep timer to 1 minute.