Best way to toggle off/on internal HDDs?

I want a bunch of HDDs for storage in my computer, but I want to be able to turn them off when I don’t want the noise. Yes, I run Linux. What’s the most elegant way to stop them from spinning when not in use? Some kind of hard power switch wired to the outside of the case? Some sleep command? Sometimes they won’t be in use for weeks.
Thanks!

Wouldn’t a NAS be a better idea for that?

As soon as they are unmounted they will go to sleep because there’s no access.

Just set them up so they don’t automount.

2 Likes

Cool, thanks. Could one keep an unformatted drive connected in a way that will be automatically added to a zpool if another drive fails (maybe if it doesn’t pass some test like SMART)?

Yes, the word you’re looking for is Hot Spare.

It will be formatted and added to the pool (not a vdev) at creation, and assigned to a vdev when needed. If you have only one vdev it is probably more useful to have it incorporated from the start as an additional redundant drive.

See also this post:

1 Like

Sweet, thanks. I thought hot spare was just for hardware raid.

So this means I can have a zfs z2 pool that is silent when unmounted + a hot spare for when any of them dies.

Not sure about silent, the system will still power them on, and OS will still query the controller, maybe even spin them up every now and then.
But lower power state for sure, and not spinning full blast.

As I understand it from @mihawk90, having them unmounted in Linux will allow them to stop spinning. If not, then yes - I will look into turning them off, like my OP / question.

I just use hdparm -y /dev/sda1 > /dev/null
The disk is not unmounted. If something touches the data on it, it will wake up.

Cool. I found this which seems to agree:

Found some other posts that recommended sdparm instead.

Do you have a reason for that? Do you have SAS / SCSI?
You might as well use sg3_utils or go all out and be interested in openSeaChest.

That tool looks really cool. Nice one

Ah maybe the commenters were… My question is just for normal SATA HDDs.

This topic was automatically closed 273 days after the last reply. New replies are no longer allowed.