JWK - Jackall's IT Wiki

Sécurité, Système, Réseau

Outils pour utilisateurs

Outils du site


smartmontools

Smartmontools

Introduction

Smartmontools is a small utility that allow you to perform hard disk health check.

<note important>Following commands are base on Gentoo version of smartmonntools</note>

Usage

Is you hard drive compatible with smartmontools

Cain ~ # smartctl -i /dev/sda
 smartctl 5.42 2011-10-20 r3458
 [x86_64-linux-3.5.4-hardened-r1-xxxx-std-ipv6-64] (local build)
 Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
 
 === START OF INFORMATION SECTION ===
 Model Family:     Seagate Barracuda 7200.12
 Device Model:     ST31000524AS
 Serial Number:    9VPD1RX4
 LU WWN Device Id: 5 000c50 035bce04d
 Firmware Version: JC4B
 User Capacity:    1 000 204 886 016 bytes [1,00 TB]
 Sector Size:      512 bytes logical/physical
 Device is:        In smartctl database [for details use: -P show]
 ATA Version is:   8
 ATA Standard is:  ATA-8-ACS revision 4
 Local Time is:    Fri Mar 22 20:27:12 2013 CET
 SMART support is: Available - device has SMART capability.
 SMART support is: Enabled

Basic health check test

Cain ~ # smartctl -H /dev/sda
smartctl 5.42 2011-10-20 r3458
[x86_64-linux-3.5.4-hardened-r1-xxxx-std-ipv6-64] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

List errors

Cain ~ # smartctl -l error /dev/sda
smartctl 5.42 2011-10-20 r3458
[x86_64-linux-3.5.4-hardened-r1-xxxx-std-ipv6-64] (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

Ok no error this time.

Manually test a hard drive (short test )

Cain ~ # smartctl -t short  /dev/sda 
=== 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 Sat Mar 23 02:41:17 2013
 
Use smartctl -X to abort test.

Results :

Cain ~ # smartctl -l selftest /dev/sda
smartctl 5.42 2011-10-20 r3458
[x86_64-linux-3.5.4-hardened-r1-xxxx-std-ipv6-64] (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%     14059         -
# 2  Short offline       Completed without error       00%        17         -
# 3  Short offline       Completed without error       00%        14         -
# 4  Short offline       Completed without error       00%        14         -

Schedule Test

modify smartd.conf file voici mes options

 #DEVICESCAN
 
 /dev/sda -a -o on -S on -s (S/../.././01|L/../../7/06) -m root@localhost
 
  • -a enable default options
  • -o enable offline tests
  • -S autosave
  • -s Scheduling REGEX (see below)
 (S/../.././01|L/../../7/06)

is a regular expression tha define When and What tests the health test will be performed

Here is the REGEX structure:

T/MM/DD/d/HH

T type =⇒ 2 possible values:

  • S ⇒ short test
  • L ⇒ Long test
  • MM Month (01 (January) to 12 (December))
  • DD Numeric day of month (01 to 31)
  • d Nimeric Day of Week ( 1 (Monday) to 7 (Sunday) )
  • HH start time

search?q=Security%20DiskHealthCheck%20Gentoo%20Linux%20EN&amp;btnI=lucky

smartmontools.txt · Dernière modification: 2018/02/18 16:01 (modification externe)