lynix / hdd-spindown.sh Goto Github PK
View Code? Open in Web Editor NEWAutomatic Disk Standby using Kernel diskstats and hdparm
License: MIT License
Automatic Disk Standby using Kernel diskstats and hdparm
License: MIT License
I've tried with sda/sdb etc, but I've noticed that, if I change the USB ports, the device names will change (sda->sdb, sdb->sdc, sdc->sda). One of these devices is HDD but the others are SSDs.
The script won't work if it gets an SSD devicename. This problem should be solved by identifying via uuid.
Thanks!
Sorry newbie here, how do i install the script? Can't find any install instructions in the readme.
Hi,
I'm not sure if it's just me but hdd-spindown has stopped suspending disks on my machine after a recent Arch update. I have tried to track it down but was unable to figure out what's stopping it. I think it has something to do with the new Linux kernel. After upgrading to 5.5.5, hdd-spindown doesn't suspend anymore. All the logs look normal and there are no errors reported. My .rc file is super simple: an ID for a single disk and a timeout. It has worked fine for over a year so something must have changed in the kernel and the way that hdd-spindown tacks no disk activity.
Hi!
I've been using hdd-spindown.sh for quite some time now and never had any issues. However, after the recent update, hdd-spindown.sh never puts my HDD to sleep anymore. I've updated the package from AUR last night and noticed issues today.
First issue I've noticed after the update was that the service was disabled. After enabling and starting the service manually, service reports that it's up and running:
$ systemctl status hdd-spindown.service
● hdd-spindown.service - Automatic Disk Standby
Loaded: loaded (/usr/lib/systemd/system/hdd-spindown.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2017-07-12 21:31:52 EDT; 40min ago
Main PID: 515 (hdd-spindown.sh)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/hdd-spindown.service
├─ 515 /bin/bash /usr/bin/hdd-spindown.sh
└─7931 sleep 300
Jul 12 21:31:52 exp1 systemd[1]: Started Automatic Disk Standby.
Jul 12 21:31:52 exp1 hdd-spindown.sh[515]: Using 300s interval
But my disk is never put to sleep. If I issue an hdparm request manually, the HDD does spin down (I can hear it spin down).
And then, sometimes later I see this in my journal:
Jul 12 22:21:59 exp1 hdd-spindown.sh[515]: spinning up sdb
so it's spinning up the disk on its own at who knows what interval. Really strange.
My rc file is simple:
$ cat /etc/hdd-spindown.rc
CONF_INT=300
CONF_DEV=("sdb|300")
What is going on? Thanks in advance!
PS: Using Arch, latest version from AUR.
Hi,
I have a bunch of HDDs and I've noticed that when one of the disks is disconnected (i.e. missing from the system), hdd-spindown fails to spin down the rest of the disks and reports a failure. For example:
Sep 07 17:51:42 aar systemd[1]: Started Automatic Disk Standby.
Sep 07 17:51:42 aar hdd-spindown.sh[731]: Using 600s interval
Sep 07 17:51:42 aar hdd-spindown.sh[731]: recognized disk: ata-ST4000N00 --> sdd
Sep 07 17:51:42 aar hdd-spindown.sh[731]: error: device not found: 'ata-WDC_WD1001'
Sep 07 17:51:42 aar systemd[1]: hdd-spindown.service: Main process exited, code=exited, status=1/FAILURE
Sep 07 17:51:42 aar systemd[1]: hdd-spindown.service: Failed with result 'exit-code'.
Inside of the .rc file, I have a simple CONF_DEV=
declaration that lists all disks by their ATA-ID.
In situations such as this, I'd assume that the program would ignore missing disks and just manage the rest of them. This would be especially useful if you have an external enclosure that might or might not be connected...
Thanks!
This script does not work on my machine(Xubuntu 20.04.2). So I checked the shell script. When I comment out line 68,my hard drive can sleep normally.
I manually run smartctl -i -n standby "/dev/sdd"
, the "Power mode" is ACTIVE or IDLE
. Is this result related to different Linux distributions?
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.8.0-55-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org=== START OF INFORMATION SECTION ===
Model Family: Western Digital Blue
Device Model: WDC WD5000AAKX-75U6AA0
Serial Number: WD-WCC2ELL61791
LU WWN Device Id: 5 0014ee 25e35cee0
Firmware Version: 19.01H19
User Capacity: 500,107,862,016 bytes [500 GB]
Sector Size: 512 bytes logical/physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS (minor revision not indicated)
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Tue Jun 8 15:36:44 2021 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Power mode is: ACTIVE or IDLE
Hi All,
I've tried this script, and noticed that, if the external enclosure isn't supported officially by smartctl, the script won't work, even the other solutions.
Luckily the bypass trick is very simple. The root cause is that, the smartctl says: "Unknown USB bridge". This can be bypassed with the -d sat
parameter.
I've replaced all of smartctl instances in your script like this: smartctl -d sat
.
Voilá, the script is working so good.
May I suggest to implement this trick in the next release to stop wasting time by others who have officially unsupported enclosures like me?
Important! This trick will work only that case if sudo hdparm -C /dev/sda
command also works, otherwise my suggestion won't get affected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.