silencing an idle HDD

An idle HDD can be unmounted and put to sleep, but (eg.) debian still wakes the disk from time to time.
to prevent that we can set the HDD state to offline.
this way, all attempts to access the disk will fail, and the disk stays asleep.

the disk state is specified by writing either “running” or “offline” to /sys/block/sdb/device/state

example:
[code language=”bash”]
echo "offline" | sudo tee /sys/block/sdb/device/state
[/code]

Posted in IT