domingo, 14 de octubre de 2012

Testear los discos duros utilizando smartctl


Vamos a chechear el estado de discos duros que soporten la tecnología SMART (Self-Monitoring, Analysis and Reporting Technology)

Para ello utilizaremos las Smartmon tools http://smartmontools.sourceforge.net

Instalamos las smartmon tools:
$ sudo aptitude install smartmontools

Utilizaremos el comando smartctl.


Primero necesitamos identificar el disco a testear:
Listar los dispositivos de almacenamiento del sistema


Supongamos que el disco duro a testear está asociado al fichero /dev/sdb. Necesitamos permisos para acceder a dicho dispositivo. Si no, utilizaremos sudo.


Obtenemos información del disco duro


$ sudo smartctl -i /dev/sdb
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.0.0-1-amd64] (local build)                                                      
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
                                                                                                                               
=== START OF INFORMATION SECTION ===                                                                                           
Device Model:     TOSHIBA MK3483GSX                                                                                            
Serial Number:    91UF003ES                                                                                                    
LU WWN Device Id: 5 000039 385e8ff10                                                                                           
Firmware Version: GT001U                                                                                                       
User Capacity:    320,072,933,376 bytes [320 GB]                                                                               
Sector Sizes:     512 bytes logical, 4096 bytes physical                                                                       
Device is:        Not in smartctl database [for details use: -P showall]                                                       
ATA Version is:   8                                                                                                            
ATA Standard is:  Exact ATA specification draft version not indicated                                                          
Local Time is:    Fri Jan 27 18:47:22 2012 CET                                                                                 
SMART support is: Available - device has SMART capability.                                                                     
SMART support is: Enabled


Comprobamos si hay errores previos


$ sudo smartctl -l error /dev/sdb
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.0.0-1-amd64] (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


TEST Rápido


$ sudo smartctl -t short /dev/sdb
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.0.0-1-amd64] (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 2 minutes for test to complete.                                                                                    
Test will complete after Fri Jan 27 18:51:22 2012                                                                              
                                                                                                                               
Use smartctl -X to abort test.


Después de esperar el tiempo que indique la respuesta del comando revisaremos los errores.
$ sudo smartctl -l error /dev/sdb


TEST LARGO


$ sudo smartctl -t long /dev/sdb
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.0.0-1-amd64] (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 Extended self-test routine immediately in off-line mode".                                      
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.                              
Testing has begun.                                                                                                             
Please wait 100 minutes for test to complete.                                                                                  
Test will complete after Fri Jan 27 20:37:44 2012                                                                              
                                                                                                                               
Use smartctl -X to abort test.

Una vez pasado el tiempo especificado comprobamos los errores:
$ sudo smartctl -l error /dev/sdb


REFERENCIA


$ man smartctl

http://www.cyberciti.biz/tips/monitoring-hard-disk-health-with-smartd-under-linux-or-unix-operating-systems.html

3 comentarios: