SATA Disk Inspection and Troubleshooting

The purpose of this page is to list some tools for SATA disk or device troubleshooting on Unix-like operating systems. Serial ATA is specified by the SATA International Organization; the most current revision as of October 2015 is SATA 3.2, released August 2013. Intel specifies the Advanced Host Controller Interface; as of October 2015 the most recent revision is 1.3.1 [link to pdf]. The SMART page has some additional info.

hddtemp

hddtemp gives you the temperature of your hard drive by reading SMART data if available. More specifically, hddtemp handles current SATA devices as long as they’re reporting SMART code Temperature_Celsius or Airflow_Temperature_Celsius on ID# 194. A normal response looks like this:

$ sudo hddtemp /dev/sd?
/dev/sda: WDC WD10EACS-00ZJB0: 38°C

If hddtemp reports “no sensor” several things could be happening:

  1. Your disk genuinely doesn’t have a temperature sensor (as is the case with some rotational disks, and quite a few SSDs)
  2. Your disk is reporting Temperature_Celsius on another SMART ID# (190 is common, again with SSDs)
  3. The temp sensor is defective or buggy in some way

Some drives (e.g., some Seagate models) are known to falsely report absurd temperatures here (150+ degrees Celsius). A weird value here doesn’t necessarily mean your disk is about to cook off and explode.

You can try to determine the correct temp ID by running hddtemp with the debug flag:

$ hddtemp --debug /dev/sda
INTEL SSDSC2BW180A3L

field(5)	 = 0
field(9)	 = 35
field(12)	 = 101
field(170)	 = 0
field(171)	 = 0
field(172)	 = 0
field(174)	 = 96
field(183)	 = 0
field(184)	 = 0
field(187)	 = 0
field(190)	 = 42
field(192)	 = 96
field(199)	 = 0
field(225)	 = 80
field(226)	 = 255
field(227)	 = 12
field(228)	 = 255
field(232)	 = 0
field(233)	 = 0
field(241)	 = 80
field(242)	 = 23
field(249)	 = 69

In this case field 190 looks like a good candidate, so we’ll go with that. Copying some files to the disk should increase that value if you’re uncertain. You can also try to determine the temperature ID by running smartctl -a /dev/sdX (see below).

If you can successfully determine the temperature ID#, open the hddtemp database file “hddtemp.db”. This file can be located in different places, most likely /etc or /etc/default. Add something like the following (I’m using my own laptop’s SSD here as an example):

########################################
############# My Intel SSD
########################################
"INTEL SSDSC2BW180A3L"   190     C       "INTEL SSD 520 Series SATA III"

The first value is the model ID, the second is the ID reporting Temperature_Celsius, C or F specifies Celsius or Fahrenheit, and the last field is a meaningful name for the disk. Save and close the file and run hddtemp /dev/sda again. It should now show the correct values:

$ hddtemp  /dev/sda
/dev/sda: INTEL SSDSC2BW180A3L: 45°C

lsscsi For a SATA Disk

lsscsi is intended to inspect SCSI devices in Linux, but it seems to work fine with SATA devices:

<p>$ lsscsi -l</p>
[0:0:0:0]    disk    ATA      INTEL SSDSC2BW18 LF1i  /dev/sda
  state=running queue_depth=31 scsi_level=6 type=0 device_blocked=0 timeout=30
[1:0:0:0]    cd/dvd  MATSHITA DVD-RAM UJ8C0    SB01  /dev/sr0
  state=running queue_depth=1 scsi_level=6 type=5 device_blocked=0 timeout=30 

$ lsscsi -H -v

[0]    ahci
  dir: /sys/class/scsi_host//host0
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0
[1]    ahci
  dir: /sys/class/scsi_host//host1
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/ata2/host1
[2]    ahci
  dir: /sys/class/scsi_host//host2
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/ata3/host2
[3]    ahci
  dir: /sys/class/scsi_host//host3
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/ata4/host3
[4]    ahci
  dir: /sys/class/scsi_host//host4
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/ata5/host4
[5]    ahci
  dir: /sys/class/scsi_host//host5
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/ata6/host5 

$ lsscsi -v

[0:0:0:0]    disk    ATA      INTEL SSDSC2BW18 LF1i  /dev/sda
  dir: /sys/bus/scsi/devices/0:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0]
[1:0:0:0]    cd/dvd  MATSHITA DVD-RAM UJ8C0    SB01  /dev/sr0
  dir: /sys/bus/scsi/devices/1:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0] 

SMART for a SATA Disk

SMART is a monitoring system, available in most modern hard disks, that tries to diagnose disk status and predict failure. You can determine a disk’s SMART capability with smartctl -i:

$ smartctl -i /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-24-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     INTEL SSDSC2BW180A3L
Serial Number:    CVCV31340221180EGN
LU WWN Device Id: 5 5cd2e4 00007bd64
Firmware Version: LF1i
User Capacity:    180,045,766,656 bytes [180 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Oct 10 17:16:53 2015 CDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled 
[recombinator](0) $ sudo smartctl -i /dev/sda
smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

You can tell if the specific hard drive model is known via -P show (this isn’t necessary for SMART to be used):

$ smartctl -a /dev/sda -P show
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-24-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

No presets are defined for this drive.  Its identity strings:
MODEL:    INTEL SSDSC2BW180A3L
FIRMWARE: LF1i
do not match any of the known regular expressions.
Use -P showall to list all known regular expressions.

A disk that is known will look like this:

$ smartctl -a /dev/sda -P show
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-24-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

Drive found in smartmontools Database.  Drive identity strings:
MODEL:              ST31000340AS
FIRMWARE:           SD13
match smartmontools Drive Database entry:
MODEL REGEXP:       ^ST3(500[368]2|750[36]3|1000[36]4)0AS?$
FIRMWARE REGEXP:    .*
MODEL FAMILY:       Seagate Barracuda 7200.11
ATTRIBUTE OPTIONS:  None preset; no -v options are required.

To view the current statistics for a drive, use smartctl -a:

$ smartctl -a /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-24-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     INTEL SSDSC2BW180A3L
Serial Number:    CVCV31340221180EGN
LU WWN Device Id: 5 5cd2e4 00007bd64
Firmware Version: LF1i
User Capacity:    180,045,766,656 bytes [180 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Oct 10 17:18:51 2015 CDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

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

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                (    0) seconds.
Offline data collection
capabilities:                    (0x7f) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Abort Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        (  48) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x0021) SCT Status supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0032   100   100   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   096   096   000    Old_age   Always       -       4138 (162 92 0)
 12 Power_Cycle_Count       0x0032   099   099   000    Old_age   Always       -       1382
170 Unknown_Attribute       0x0033   100   100   010    Pre-fail  Always       -       0
171 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
174 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       1377
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   097    Pre-fail  Always       -       0
190 Temperature_Celsius     0x0032   045   048   000    Old_age   Always       -       60
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       1377
199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
225 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       204159
226 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       65535
227 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       12
228 Power-off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       65535
232 Available_Reservd_Space 0x0033   100   100   010    Pre-fail  Always       -       0
233 Media_Wearout_Indicator 0x0032   100   100   000    Old_age   Always       -       0
241 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       204159
242 Total_LBAs_Read         0x0032   100   100   000    Old_age   Always       -       29244
249 Unknown_Attribute       0x0013   100   100   000    Pre-fail  Always       -       3660

SMART Error Log not supported

SMART Self-test Log not supported

SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

hdparm

hdparm can be used to view (and set) the parameters of SATA/IDE disk drives:

$ hdparm -I /dev/sda
/dev/sda:

ATA device, with non-removable media
        Model Number:       INTEL SSDSC2BW180A3L
        Serial Number:      CVCV31340221180EGN
        Firmware Revision:  LF1i
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
        Used: unknown (minor revision code 0xffff)
        Supported: 9 8 7 6 5
        Likely used: 9
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors:  351651888
        Logical  Sector size:                   512 bytes
        Physical Sector size:                   512 bytes
        Logical Sector-0 offset:                  0 bytes
        device size with M = 1024*1024:      171705 MBytes
        device size with M = 1000*1000:      180045 MBytes (180 GB)
        cache/buffer size  = unknown
        Nominal Media Rotation Rate: Solid State Device
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 16
        Advanced power management level: 254
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
                Look-ahead
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    NOP cmd
           *    DOWNLOAD_MICROCODE
           *    Advanced Power Management feature set
           *    48-bit Address feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    64-bit World wide name
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Host-initiated interface power management
           *    Phy event counters
           *    DMA Setup Auto-Activate optimization
                Device-initiated interface power management
           *    Software settings preservation
           *    SMART Command Transport (SCT) feature set
           *    SCT Data Tables (AC5)
           *    reserved 69[4]
           *    WRITE BUFFER DMA command
           *    READ BUFFER DMA command
           *    Data Set Management TRIM supported (limit 1 block)
           *    Deterministic read data after TRIM
Security:
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
                supported: enhanced erase
        4min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 55cd2e400007bd64
        NAA             : 5
        IEEE OUI        : 5cd2e4
        Unique ID       : 00007bd64
Checksum: correct

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *