Skip to content

Instantly share code, notes, and snippets.

@thehaven
Last active August 29, 2015 13:56
Show Gist options
  • Save thehaven/8801222 to your computer and use it in GitHub Desktop.
Save thehaven/8801222 to your computer and use it in GitHub Desktop.
Simple way to detect whether a drive is a spindle or not.
#!/bin/bash
# pass the drive argument to this script when calling i.e. ./script.sh sda
# see: http://www.mjmwired.net/kernel/Documentation/block/queue-sysfs.txt for other parameters
if [ "$( find /sys -name rotational | grep $0 | xargs cat )" ]; then
echo "its a spinny!"
else
echo "its an SSD or Flash!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment