Add script to show disks and their rotational status

This commit is contained in:
Nico Schottelius 2021-07-28 11:05:18 +02:00
parent c9cf6d2457
commit 95f162c811
1 changed files with 19 additions and 0 deletions

19
check-disks-rotational.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
if [ $# -lt 1 ]; then
echo $0: server [server...]
exit 1
fi
while [ $# -ge 1 ]; do
server=$1; shift
ssh root@$server "
cd /sys/block/
for dev in sd*; do
size=\$(fdisk -l | grep ^Disk | grep \$dev | awk '/bytes/ { print \$3 \" \" \$4 }')
printf \"${server} \${dev} \${size} rotational: \"
cat \$dev/queue/rotational
done
"
done