10 let PATH = stdenv.lib.makeBinPath
15 ] + ":$PATH"; # For sudo
17 writeShellScriptBin "smartctl-tbw" ''
19 device=''${1:-/dev/sda}
20 sudo ${smartmontools}/bin/smartctl -A $device |
22 $0 ~ /Power_On_Hours/ { poh=$10; printf "%s / %d hours / %d days / %.2f years\n", $2, $10, $10 / 24, $10 / 24 / 365.25 }
23 $0 ~ /Total_LBAs_Written/ {
29 printf "%s / %s / %d mb / %.1f gb / %.3f tb\n", $2, $10, mb, gb, tb
30 printf "mean writes per hour: / %.2f", mb/poh
32 $0 ~ /Airflow_Temperature_Cel/ { print $2 " / " $10}
33 $0 ~ /Wear_Leveling_Count/ { printf "%s / %d (%% health)\n", $2, int($4) }
36 sed -e "s\$^\$$device @ \$" |