smartctl
Settings à mettre de base
/usr/sbin/smartctl --smart=on --offlineauto=off --saveauto=on /dev/sda
Lancer un "short test" (attendre au moins 2 minutes avant de consulter le résultat)
smartctl -t short /dev/sda
Les options possible sont : offline, short, long, conveyance, force, vendor,N, select,M-N, pending,N, afterselect,[on|off]
Pour voir les données amassées par le Smart (produit un tableau)
smartctl -A /dev/sda
Afficher le log d'erreur
smartctl -l error /dev/sda
Produces output only if the device returns failing SMART status, or if some of the logged self-tests ended with errors.
smartctl -q errorsonly -H -l selftest /dev/sda
Examine all SMART data for device /dev/sda, but produce no printed output. You must use the exit status (the $? shell variable) to learn if any Attributes are out of bound, if the SMART status is failing, if there are errors recorded in the self-test log, or if there are errors recorded in the disk error log.
smartctl -q silent -a /dev/sda ; echo $?
Afficher le log du selftest
smartctl -l selftest /dev/sda
Affiche toutes les informations
smartctl -a /dev/sda
smartctl -a /dev/sda | grep -E 'Media_Wearout_Indicator|Wear_Range_Delta|SSD_Life_Left|Wear_Leveling_Count'
SMART est-il activé?
smartctl -a /dev/sda
Tests réussit?
smartctl -Hc /dev/sda
Attributs comptabilisés:
smartctl -A /dev/sda
Log d'erreur:
smartctl -l error /dev/sda
Démarrer un test:
smartctl -t short /dev/sda
smartctl -t long /dev/sda
Rapports des self-tests:
smartctl -l selftest /dev/sda
Activer "automatic off-line testing":
smartctl -o on
Configurations personnalisées:
/etc/smartd.conf
smartctl --scan-open
/dev/sda -d sat # /dev/sda [SAT], ATA device
/dev/sdb -d sat # /dev/sdb [SAT], ATA device
/usr/sbin/smartctl --smart=on --offlineauto=off --saveauto=on /dev/sda ; \
exit_code=$? ; mask=1 ; echo "Exit Code=${exit_code}" ; for i in 0 1 2 3 4 5 6 7 ;\
do echo "Bit $i: $(((exit_code & mask) && 1))" ; mask=$((mask << 1)) ; done
-a, --all
Prints all SMART information about the disk, or TapeAlert information about the tape drive or changer. For ATA devices this is equivalent to
´-H -i -c -A -l error -l selftest -l selective´
and for SCSI, this is equivalent to
´-H -i -A -l error -l selftest´.
Note that for ATA disks this does not enable the non-SMART options and the SMART options which require support for 48-bit ATA commands.
-x, --xall
Prints all SMART and non-SMART information about the device. For ATA devices this is equivalent to
´-H -i -g all -c -A -f brief -l xerror,error -l xselftest,selftest
-l selective -l directory -l scttemp -l scterc -l devstat -l sataphy´.
and for SCSI, this is equivalent to
´-H -i -A -l error -l selftest -l background -l sasphy´.