Created
December 8, 2023 16:21
-
-
Save nicman23/0c057583fcf66d7d21f8d4c4af5d38e0 to your computer and use it in GitHub Desktop.
zfs hdd spindown script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
pool=zdata | |
devices=$(zpool status -P $pool | grep /dev/ | awk '{print $1}') | |
intervalinsec=120 | |
while true; do | |
zpool iostat -HyL zdata $intervalinsec 1 | | |
grep -q '0 0 0 0' ; res=$? | |
if [ $res -eq 0 ]; then | |
for i in `echo $devices`; do | |
hdparm -Y $i | |
done | |
while ( smartctl -i -n standby ${devices[0]} | grep -q 'Device is in STANDBY' ); sleep 1m | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment