Diskinfo.sh

From Ye Ole Stash
Jump to: navigation, search
#!/bin/bash
 
#Version 0.5
for i in `ls /sys/block/ | grep sd`; do
    echo "Drive $i";
    smartctl -A /dev/$i | grep 0x | awk '{print $2,$10}' | sed 's/ /\n/g';
done
  • For SAS Drives (ALT)
This shows only drive temp for the drive
#!/bin/bash
 
#Version 0.5
for i in `ls /sys/block/ | grep sd`; do
    echo "Drive $i";
    smartctl -A /dev/sda | grep Current | grep -o [0-99][0-99]
done

Versions that dont work

Wont work with more than 2 drives - Cuts off list at 100

#!/bin/bash
 
#Version 0.2a
 
for i in `ls /sys/block/ | grep sd`; do
    echo "Drive $i";
    for d in `smartctl -A /dev/$i | grep 0x | awk '{print $2,$10}'`;do
        echo $d
    done
done
Personal tools