How can I make a HDD shut down automatically if it is not being used?

3 years ago by Xirup to c/linux

I recently installed Windows in dual boot with Linux (on two different SSDs) and I noticed that Windows automatically "shuts down" or stops the HDD if it is not being used.

I have a HDD (WD) connected by SATA cable where I usually keep my games. The HDD is not always in use but it is always constantly running and honestly the noise it makes is quite noticeable. I'm sure I don't have any program in the background using it constantly.

I have already tried to solve this problem using hdparm and hd-idle and although in theory they work I still hear the noise from the HDD.

bobthecowboy 11 points 3 years ago

You may want to research this some more. Spinning the drive up and down adds wear on the mechanical parts, and will lead to the drive failing a lot sooner.

Maybe you're okay with that tradeoff, just thought you should at least be aware of it.

path: 0 431777, hotness: undefined, score: 11, children: 0
Unimeron 5 points 3 years ago

Checkout smartctl. You can either force shutdown immediately or after some idle time. Command is something like this:

smartctl -n -s standby,VALUE /dev/sda with value either "now" or something between 0 and 255. From the manpage:

Values from 1 to 240 specify timeouts from 5 seconds to 20 minutes in 5 second increments. Values from 241 to 251 specify timeouts from 30 minutes to 330 minutes in 30 minute increments. Value 252 specifies 21 minutes. Value 253 specifies a vendor specific time between 8 and 12 hours. Value 255 specifies 21 minutes and 15 seconds.

path: 0 423509, hotness: undefined, score: 5, children: 4
Revan343 4 points 3 years ago

Value 252 specifies 21 minutes.

That's interestingly specific. Any idea why?

path: 0 423509 443581, hotness: undefined, score: 4, children: 3
jared 3 points 3 years ago path: 0 423509 443581 460175, hotness: undefined, score: 3, children: 0
pressanykeynow 3 points 3 years ago

252 * 5 sec = 1260 sec or 21 min. I wonder what 254 does...

path: 0 423509 443581 452466, hotness: undefined, score: 3, children: 0
shmanio 1 point 3 years ago

Also, why is 255 21 minutes and 15 seconds? And why is there no 254?

path: 0 423509 443581 445514, hotness: undefined, score: 1, children: 0
d3Xt3r 3 points 3 years ago

If your only concern is noise (and not saving power), then the easiest solution is to just sound-proof your case - install some foam pads or something to dampen the noise. Check out https://www.quietpc.com/acousticmaterials to get an idea of what's out there and what you can use, but even simple random foam that you'd get in parcels would work to start off with.

path: 0 454578, hotness: undefined, score: 3, children: 0
ripreddit 3 points 3 years ago

Hdparm has 2 -(Yy) flags that should work for you

path: 0 420515, hotness: undefined, score: 3, children: 2
Xirup 0 points 3 years ago

In fact I tried it and it did work, and I could create a script that does it automatically, the only problem is that how can I make the script detect that there are no processes that depend on the HDD?

path: 0 420515 441883, hotness: undefined, score: 0, children: 1
ripreddit 1 point 3 years ago

If that's your goal I would set the apm on the disk so it spins down quickly when not active.

hdparm -B 50 -S 30 /dev/disk

path: 0 420515 441883 441884, hotness: undefined, score: 1, children: 0
Riktastic 2 points 3 years ago

A HDD shouldn't make so much noise. I have a NAS with 4 drives, it produces almost no noise. I think that you have to check the SMART values of your drive. Just to make sure that your drive is not dying.

path: 0 431202, hotness: undefined, score: 2, children: 1
lka1988 1 point 3 years ago

I think the fan in my Sabrent 4-bay drive enclosure is louder than the hard drives themselves.

path: 0 431202 453178, hotness: undefined, score: 1, children: 0
gmg 2 points 3 years ago

The hdparm -B and -S options should allow you to have your drive automatically spin-down when inactive, but they don't work on all dives (eg. my NAS has two shucked WD white that seem to just ignore those settings). If those fail, you could schedule a hdparm -y to spin down the drive periodically.

Make sure to read man hdparm as there are some dangerous options.

PS: there's also https://github.com/adelolmo/hd-idle - I've not tried it out yet, but it seems promising

path: 0 421048, hotness: undefined, score: 2, children: 0
elmicha 1 point 3 years ago

Maybe you can unmount the HDD, then no process can access it and hd-idle could work.

path: 0 422038, hotness: undefined, score: 1, children: 1
Xirup 1 point 3 years ago

I tried it and it didn't work... Thanks for the idea actually, I hadn't thought about it.

path: 0 422038 443294, hotness: undefined, score: 1, children: 0
linux
linux

@lemmy.ml

login for more options
68145
9470
5670

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

go to feed...