Kabul edilen yanıt çıktıyı şişirdi, çok fazla işe yaramaz script-wizardry ve başlangıçtaki parametre adlarını gizler smartctl
. İşte daha iyi bir sürüm;
#!/bin/bash
device=${1:-/dev/sda}
sudo smartctl -A $device |awk '
$0 ~ /Power_On_Hours/ { poh=$10; printf "%s / %d hours / %d days / %.2f years\n", $2, $10, $10 / 24, $10 / 24 / 365.25 }
$0 ~ /Total_LBAs_Written/ {
lbas=$10;
bytes=$10 * 512;
mb= bytes / 1024^2;
gb= bytes / 1024^3;
tb= bytes / 1024^4;
printf "%s / %s / %d mb / %.1f gb / %.3f tb\n", $2, $10, mb, gb, tb
printf "mean writes per hour: / %.2f", mb/poh
}
$0 ~ /Airflow_Temperature_Cel/ { print $2 " / " $10}
$0 ~ /Wear_Leveling_Count/ { printf "%s / %d (%% health)\n", $2, int($4) }
' |
sed -e 's:/:@:' |
sed -e "s\$^\$$device @ \$" |
column -ts@
örnek çıktı:
$ for i in /dev/sd{a,b,c,d}; do ssd-tbw $i;done |sort -k2,2
/dev/sda Airflow_Temperature_Cel 49
/dev/sdb Airflow_Temperature_Cel 49
/dev/sdc Airflow_Temperature_Cel 45
/dev/sdd Airflow_Temperature_Cel 47
/dev/sda mean writes per hour: 655.80
/dev/sdb mean writes per hour: 646.97
/dev/sdc mean writes per hour: 874.49
/dev/sdd mean writes per hour: 733.95
/dev/sda Power_On_Hours 27292 hours / 1137 days / 3.11 years
/dev/sdb Power_On_Hours 27300 hours / 1137 days / 3.11 years
/dev/sdc Power_On_Hours 14432 hours / 601 days / 1.65 years
/dev/sdd Power_On_Hours 23255 hours / 968 days / 2.65 years
/dev/sda Total_LBAs_Written 36655329806 / 17898110 mb / 17478.6 gb / 17.069 tb
/dev/sdb Total_LBAs_Written 36172538301 / 17662372 mb / 17248.4 gb / 16.844 tb
/dev/sdc Total_LBAs_Written 25846999325 / 12620605 mb / 12324.8 gb / 12.036 tb
/dev/sdd Total_LBAs_Written 34955224738 / 17067980 mb / 16668.0 gb / 16.277 tb
/dev/sda Wear_Leveling_Count 93 (% health)
/dev/sdb Wear_Leveling_Count 93 (% health)
/dev/sdc Wear_Leveling_Count 95 (% health)
/dev/sdd Wear_Leveling_Count 94 (% health)
ve tek astarlı
$ sudo /usr/sbin/smartctl -A /dev/sda |
awk '$0~/LBAs/{ printf "TBW %.1f\n", $10 * 512 / 1024^4 }'
TBW 17.1
Total_LBAs_Written
2268 olduğunu bildiriyor ve bu 1,1 MB yazıyor - bir yıldan eski bir sürücü için açıkça yanlış ve birincil sistem sürücüm :(