Skip to content

Instantly share code, notes, and snippets.

@ap
Created April 20, 2014 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ap/11113130 to your computer and use it in GitHub Desktop.
Save ap/11113130 to your computer and use it in GitHub Desktop.
Spin down unused ATA disks on Linux
#!/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.'
@ap
Copy link
Author

ap commented Apr 20, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment