====== Monitorizar discos ====== ===== Configurar ===== Instalamos smartmontools Mirar errores: smartctl -l error /dev/sda Hacer test rapido/largo, esperar el tiempo y mirar errores: smartctl -t short /dev/sda smartctl -t long /dev/sda Test Corto: # smartctl -t short /dev/sda smartctl 5.41 2011-06-09 r3365 [x86_64-linux-2.6.32-26-pve] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Execute SMART Short self-test routine immediately in off-line mode". Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful. Testing has begun. Please wait 1 minutes for test to complete. Test will complete after Mon Jul 7 17:44:35 2014 Use smartctl -X to abort test. Comprobamos que no ha dado errores: # smartctl -l error /dev/sda smartctl 5.41 2011-06-09 r3365 [x86_64-linux-2.6.32-26-pve] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF READ SMART DATA SECTION === SMART Error Log Version: 1 No Errors Logged El Test Largo indica que tardará unos 130 minutos # smartctl -t long /dev/sda Para ver si ha acabado. Vemos que solo ha acabado el corto: # smartctl -l selftest /dev/sda smartctl 5.41 2011-06-09 r3365 [x86_64-linux-2.6.32-26-pve] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net ===== START OF READ SMART DATA SECTION ===== SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Short offline Completed without error 00% 515 - ===== Añadir Monitorización con correo ===== Fuente: http://blog.shadypixel.com/monitoring-hard-drive-health-on-linux-with-smartmontools/ Cambiamos el fichero /etc/smartd.conf y añadimos la monitorización de los discos, por ejemplo un test Largo (L) el lunes (número 1) a las 19 /dev/sda -d sat -s L/../../1/19 -m correo@example.com Añadimos también un test corto cada dia a las 2 de la mañana y el largo lunes a las 3: /dev/sda -d sat -s (S/../.././02|L/../../1/19) -m correo@example.com Para que se ejecute al arrancar el servidor, en el fichero /etc/default/smartmontools descomentamos la línea start_smartd=yes Arrancamos el servicio # /etc/init.d/smartd status /usr/sbin/smartd is not running. # /etc/init.d/smartd start Starting S.M.A.R.T. daemon: smartd.