Yes. Here's what I use:
hdparm -B 127 /dev/sda
hdparm -S 242 /dev/sda
From the command line as the
pi user you would have to add
sudo there. The first line enables spin down. The second one sets it to happen after 1 hour of inactivity. This is documented in
man hdparm. You may need to
sudo apt install hdparm first.
Beware that's the device node (
sda), not a partition (
It also requires that your drive be compatible with whatever generic protocol that is. I have never found one that isn't, but they are out there.
My drive is appropriately lifeless when checked. I use it mounted via network, and if it is spun down, when accessed it takes a second or two to spin up. Often this does not happen immediately because there can be some information about the filesystem cached, so, e.g., you may navigate down into a directory tree and at some arbitrary point there will be a bit of a freeze before you can keep going.
Other than that, leaving partitions mounted is not affected by spin down, nor vice versa (spin down is not affected by leaving partitions mounted).