when we run the smartctl -a on disk we get a lot of output

what is the final status that indicates that disk is bad or good?

smartctl -a /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-327.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

Vendor:               SEAGATE
Product:              ST2000NX0433
Revision:             NS02
User Capacity:        2,000,398,934,016 bytes [2.00 TB]
Logical block size:   512 bytes
Formatted with type 2 protection
Logical block provisioning type unreported, LBPME=0, LBPRZ=0
Rotation Rate:        7200 rpm
Form Factor:          2.5 inches
Logical Unit id:      0x5000c5009eaededf
Serial number:        W46064KW
Device type:          disk
Transport protocol:   SAS
Local Time is:        Thu Nov 22 10:38:35 2018 UTC
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Disabled or Not Supported

SMART Health Status: OK

Current Drive Temperature:     23 C
Drive Trip Temperature:        60 C

Manufactured in week 06 of year 2017
Specified cycle count over device lifetime:  10000
Accumulated start-stop cycles:  49
Specified load-unload count over device lifetime:  300000
Accumulated load-unload cycles:  550
Elements in grown defect list: 0

Vendor (Seagate) cache information
  Blocks sent to initiator = 1986603075
  Blocks received from initiator = 2165723528
  Blocks read from cache and sent to initiator = 1298028358
  Number of read and write commands whose size <= segment size = 201615101
  Number of read and write commands whose size > segment size = 0

Vendor (Seagate/Hitachi) factory information
  number of hours powered up = 12335.38
  number of minutes until next internal SMART test = 26

Error counter log:
           Errors Corrected by           Total   Correction     Gigabytes    Total
               ECC          rereads/    errors   algorithm      processed    uncorrected
           fast | delayed   rewrites  corrected  invocations   [10^9 bytes]  errors
read:   26648753        0         0  26648753          0      83475.092           0
write:         0        0         2         2          2     135145.593           0
verify: 3914513941        0         0  3914513941          0     109628.879           0

Non-medium error count:       14

SMART Self-test log
Num  Test              Status                 segment  LifeTime  LBA_first_err [SK ASC ASQ]
     Description                              number   (hours)
# 1  Background short  Completed                  96       2                 - [-   -    -]
Long (extended) Self Test duration: 20400 seconds [340.0 minutes]

dose the following are good indication ?

smartctl -a /dev/sda | grep  Completed


 smartctl -a /dev/sda

echo $?
  • A variety of issues is summarized by smartctl's exit status - as detailed in the EXIT STATUS section in man smartctl. So, smartctl -a /dev/sda; echo $? is probably the best way to get a synthetic indication, but it gives no guarantee about the disk's health being bad or good. You might want to refine the definition of "bad" and "good" in your question to raise the odds of getting a precise answer.
    – fra-san
    Nov 22, 2018 at 18:29

1 Answer 1


The overall health status is that part of the output of smartctl -a that addresses the global question

Is the drive good or bad?

best. In your cited output, that status is reported in the line

SMART Health Status: OK

which can also be obtained separately (with some header) by using the -H option of smartctl, instead of -a.

Note that this assessment does not come from the smartmontools but from the drive itself (see man page smartctl(8) on -H option) and that its meaning is rather coarse: See this quote from Wikipedia:

The S.M.A.R.T. status does not necessarily indicate the drive's past or present reliability. If a drive has already failed catastrophically, the S.M.A.R.T. status may be inaccessible. Alternatively, if a drive has experienced problems in the past, but the sensors no longer detect such problems, the S.M.A.R.T. status may, depending on the manufacturer's programming, suggest that the drive is now sound.

and (same source):

More detail on the health of the drive may be obtained by examining the S.M.A.R.T. Attributes.

The overall health status is reflected by bit 3 (counting from 0) of the exit status of smartctl, which is set on failing disk. See section "RETURN VALUES" in man page smartctl(8).

Right after executing smartctl, this bit can be evaluated by the (Bash) expression $(($? & 8)) like in

if [ $(($? & 8)) -eq 0 ]; then
   echo Good.
   echo Bad.

Please note that if bit 3 is set, the expression $(($? & 8)) evaluates to 8, not 1.

An exit status of zero from smartctl is sufficient for a healthy disk (as far as S.M.A.R.T. can judge), but as a condition this might be to strong: Bit 6 of this status reflects the existence of error records in the device logs, which also may refer to communication errors between drive and host (Read DMA errors). I have several drives whose logs show such errors in their logs since their first hours of lifetime, but I used these drives on a daily basis without any problems for years. So this criterion can give you a lot of false positives. Of course this is arguable since there were errors after all.

Anyhow, if you want to take all bits but that one (bit 6) into account, you can use this expression in your test: $(($? & 191)).

On the other hand, the criterion

smartctl -a /dev/sda | grep Completed

that you mentioned says nothing about the health of the drive, since it just reports that a self-test was completed, without taking its result into account.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .