To prevent disaster it is important to know details about system's storage device in terms of runtime, number of read and writes or bad blocks to determine the overall hard drive's health and aging. The most helpful tool for this task is smartctl command found and made available for installation via smartmontools package. What follows are few command examples on how to determine current hard drive's state and overall health. To check harddrive's overall health we can use -H options. For example here is a health check for a block device /dev/sda
# smartctl -H /dev/sda
SMART overall-health self-assessment test result: PASSED
The smartctl command allows system administrator to run self-test to determine hard-drives condition. To initiate such a health self-test run the following linux command using one of the below arguments:
offline, short, long, conveyance, force, vendor,N, select,M-N, pending,N, afterselect,[on|off]
The following example will start short health check:
# smartctl -t short /dev/sda
Please wait 1 minutes for test to complete.
After running the above command the smartctl command will indicate how long you need to wait for test to be finished. The self-test results can be later retrieved by:
# smartctl -l selftest /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.14.8-200.fc20.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke,

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Vendor (0x50)       Completed without error       00%      5007         -
# 2  Offline             Completed without error       00%      5006         -
The most comprehensive health status information about your hard drive can be obtained by:
smartctl --xall /dev/sda
which will print out general device statistics table and physical event counters table:
Device Statistics (GP Log 0x04)
Page Offset Size         Value  Description
  1  =====  =                =  == General Statistics (rev 2) ==
  1  0x008  4             3878  Lifetime Power-On Resets
  1  0x010  4             5007  Power-on Hours
  1  0x018  6      13095790289  Logical Sectors Written
  1  0x020  6        677113980  Number of Write Commands
  1  0x028  6       6489046492  Logical Sectors Read
  1  0x030  6         74059526  Number of Read Commands
  4  =====  =                =  == General Errors Statistics (rev 1) ==
  4  0x008  4                0  Number of Reported Uncorrectable Errors
  4  0x010  4                0  Resets Between Cmd Acceptance and Completion
  6  =====  =                =  == Transport Statistics (rev 1) ==
  6  0x008  4            23933  Number of Hardware Resets
  6  0x010  4            10275  Number of ASR Events
  6  0x018  4                0  Number of Interface CRC Errors
  7  =====  =                =  == Solid State Device Statistics (rev 1) ==
  7  0x008  1                0  Percentage Used Endurance Indicator

SATA Phy Event Counters (GP Log 0x11)
ID      Size     Value  Description
0x0001  4            0  Command failed due to ICRC error
0x0004  4            0  R_ERR response for host-to-device data FIS
0x0007  4            0  R_ERR response for host-to-device non-data FIS
0x0008  4            0  Device-to-host non-data FIS retries
0x0009  4            1  Transition from drive PhyRdy to drive PhyNRdy
0x000a  4            2  Device-to-host register FISes sent due to a COMRESET
0x000b  4            0  CRC errors within host-to-device FIS
0x000d  4            0  Non-CRC errors within host-to-device FIS
0x000f  4            0  R_ERR response for host-to-device data FIS, CRC
0x0010  4            0  R_ERR response for host-to-device data FIS, non-CRC
0x0012  4            0  R_ERR response for host-to-device non-data FIS, CRC
0x0013  4            0  R_ERR response for host-to-device non-data FIS, non-CRC
Submit your RESUME, create a JOB ALERT.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.