Created
April 20, 2014 12:33
-
-
Save ap/11113130 to your computer and use it in GitHub Desktop.
Spin down unused ATA disks on Linux
This file contains 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/sh | |
echo -n 'Spinning down unused ATA drives:' | |
/usr/bin/lsscsi | /bin/grep -w -F ATA | /bin/cut -c54- \ | |
| while read dev ; do | |
if /bin/mount | /bin/grep -q -E "^$dev[^/]* " ; then continue ; fi | |
echo -n " $dev," | |
/sbin/hdparm -q -Y "$dev" | |
done | |
echo ' done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script looks for ATA disks that have no mounted partitions and spins them down.
It used to be part of my init scripts on a machine with a few spare disks attached.