Created
August 13, 2013 00:34
-
-
Save likewhoa/6216768 to your computer and use it in GitHub Desktop.
A BASH script to show the Sector Size count of drives using smartctl.
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
chksectorcount() { | |
local -a drives=(/dev/sd*) | |
# Iterate through array to remove partitions i.e /dev/sda1 and so on | |
((n_elements=${#drives[@]}, max_index=n_elements - 1)) | |
for ((i = 0; i <= max_index; i++)); do | |
if [[ $(echo ${drives[i]} | grep -v '[0-9]') ]]; then | |
smartctl -a ${drives[i]} | grep "Sector Sizes:"|sed "s:^:${drives[i]} :" | |
else | |
unset 'drives[i]' | |
continue | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment