Experiment used on asus p9d ws
Admin's own units go in /etc/systemd/system/, if maintaining someone elses system, use /run/systemd/system/ if programmatically generated, otherwise /lib/systemd/system/ and the system's package manager.
First lets stop the fans.
Having put operating system on SSD, have some disks for back up and less important applications.
Make some units for starting and stopping a imsm backed raid array, lets call it silencedisks.service
the umount catches "most" situtions where the mount is held open in other mount namespaces
First, the silence unit conflicts with any users of the spinning disk logical volume
systemd requires them to stop when starting this unit.
Next, use vgchange to deactivate the volume group, example called nkeep polling to see that it has removed its mappings before proceeding
Once the volume group has confirmed stopped, go on and deactivate the backing mdadm arrays, here they are intel matrixraid so stop the contents, then the containers.
The mdadm commands actually fail if the array is still in use, all my drives have imsm containers even if solitary devices.
Once the spinning arrays are stopped, detach the scsi targets. Linux issues the spin-down commands. This has been found to be better than issue spindown command via hdparm.
Silence
To reverse the situation, bring the arrays on disks to running:
This begins with scan sata bus where the drives are, to re-attach the targets. The scan commands can be done in parallel to enjoy the sound of drives spinning up together, then wait til both are in ready state, then assemble raid and lvm on top of that.