Commit graph

83 commits

Author SHA1 Message Date
Andreas Schneider
09260e5d5a
compatibility with SAS drives
Problem:
In the current version, my SAS drive had empty fields:
* Drive Model
* Serial Number
* Short/Extended test duration
The script got stuck after the first SMART short test, reporting it would wait for 0 seconds.


Assumptions:
* smartctl reports different values in different fields on SAS drives (e.g. smartctl --capabilities only reports "SCSI device successfully opened")
* Every drive offers a "short" test. SAS drives do not provide information about that
* Every drive offers a "long" test. ATA drives will translate this into "extended"
* A burn-in is not time critical but must be exhaustive


Actions:
* Made grep case insensitive for Serial number on SAS vs Serial Number on ATA
* Changed "discard first two columns" to "discard everything until first colon" in get_smart_info_value
* Added colon at the end of every inquired smart info
* Changed test behavior "if success in smartctl then success; else if error in smartctl then error" to "if ATA error in smartctl then error; else if no test in progress then success" in poll_selftest_complete


Remaining problems:
* For SAS drives it will still print and log "waiting 0 seconds for test completion"


Propositions:
* Show Progress of SMART Test / remaining % instead of a fixed "waiting for ### seconds"
* Print and log actual time until completion instead of reported test duration, or maybe both
* As even SAS drives report a "long test duration", POLL_TIMEOUT_SECONDS could be set relative to that (like 1.5x), and not fixed to 4 hours.
* Maybe warn on POLL_TIMEOUT and report time tested until now, instead of abort?
* Switch to some other output form of smartctl, like json, and parse it with something like jq


INFO ABOUT RUNNING TEST:
SAS running short test
smartctl -l selftest /dev/sdc
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.15-arch1-1] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
Self-test execution status:             84% of test remaining
SMART Self-test log
Num  Test              Status                 segment  LifeTime  LBA_first_err [SK ASC ASQ]
     Description                              number   (hours)
# 1  Background short  Self test in progress ...   -     NOW                 - [-   -    -]
# 2  Background short  Completed                   -   29626                 - [-   -    -]
# 3  Background short  Completed                   -   29626                 - [-   -    -]
# 4  Background short  Completed                   -   29625                 - [-   -    -]
# 5  Background short  Completed                   -   29625                 - [-   -    -]
# 6  Background long   Completed                   -   29625                 - [-   -    -]
# 7  Background short  Completed                   -   29612                 - [-   -    -]
# 8  Background long   Completed                   -   29608                 - [-   -    -]

Long (extended) Self-test duration: 3772 seconds [62.9 minutes]


SAS not running short test: "Self-test execution status" line is missing


ATA running extended test: smartctl -c /dev/sdg 
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.15-arch1-1] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
General SMART Values:
Offline data collection status:  (0x05) Offline data collection activity
                                        was aborted by an interrupting command from host.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      ( 242) Self-test routine in progress...
                                        20% of test remaining.
Total time to complete Offline 
data collection:                (   45) seconds.
Offline data collection
capabilities:                    (0x5b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        No 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:        (   2) minutes.
Extended self-test routine
recommended polling time:        ( 113) minutes.
SCT capabilities:              (0x003d) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.


ATA drive after abort:
Self-test execution status:      (  25)	The self-test routine was aborted by
					the host.


ATA drive after successful short test:
Self-test execution status:      (   0)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.


SMART INFO ON SAS DRIVE
# echo $SMART_INFO                                                                        
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.15-arch1-1] (local build)                               
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
                                                                                                         
=== START OF INFORMATION SECTION ===       
Vendor:               TOSHIBA                                                                            
Product:              AL13SXB600N
Revision:             5202                                                                               
Compliance:           SPC-3                                                                              
User Capacity:        600,127,266,816 bytes [600 GB]                          
Logical block size:   512 bytes                                                                          
Rotation Rate:        15000 rpm                                                                          
Form Factor:          2.5 inches                                                                         
Logical Unit id:      0x500003975861d374                                                                 
Serial number:        X6S0A03FFIYA                                                                       
Device type:          disk                                                                               
Transport protocol:   SAS (SPL-3)                                                                        
Local Time is:        Sat Nov 20 14:18:01 2021 UTC                                                       
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled                                                                            
Temperature Warning:  Disabled or Not Supported


FYI:# smartctl -A /dev/sdc
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.15-arch1-1] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
Current Drive Temperature:     51 C
Drive Trip Temperature:        65 C

Accumulated power on time, hours:minutes 29625:34
Manufactured in week 43 of year 2016
Specified cycle count over device lifetime:  50000
Accumulated start-stop cycles:  15
Specified load-unload count over device lifetime:  600000
Accumulated load-unload cycles:  15
Elements in grown defect list: 0


FYI to get info like ATA "reallocated sector" or "pending sector" os SAS devices:
# smartctl -l error /dev/sdc
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.15-arch1-1] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
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:          0     2567      1986      1986          0     993683.879           0
write:         0        0         0         0          0      49874.645           0
verify:        0        0         0         0          0     106222.531           0

Non-medium error count:        0
2021-11-20 16:53:24 +01:00
Keith Nash
66c5bb6d52
Merge pull request #19 from hogenf/patch-1
Update notes on badblocks block size to 8192
2021-10-10 09:35:22 -05:00
hogenf
aede45b87d
Update notes on badblocks block size to 8192 2021-10-09 17:48:28 +02:00
Keith Nash
43b4a05522
Update README.md 2021-02-19 15:22:44 -06:00
Keith Nash
a68e2ae834
Increased memory buffers from 4096 to 8192 2021-02-19 15:20:51 -06:00
Keith Nash
bc7d0e0e87
Update README.md 2021-02-19 15:17:57 -06:00
Keith Nash
2ef13143a5
Merge pull request #11 from justin-p/master
Additional tested drive model
2020-10-24 08:13:37 -05:00
Justin Perdok
ee67da83ab
Update README.md 2020-10-24 14:55:14 +02:00
Keith Nash
203d8c21fb
Update README.md 2020-10-06 21:55:01 -05:00
Keith Nash
4399957bac
Update README.md 2020-10-06 00:00:54 -05:00
Keith Nash
8f89419fb1
Update README.md 2020-10-05 23:57:43 -05:00
Keith Nash
71de6db4ff
Update README.md 2020-10-05 23:56:36 -05:00
Keith Nash
ad723c4980
Update README.md 2020-10-05 23:50:28 -05:00
Keith Nash
a899831ec9
Update README.md 2020-10-05 23:48:46 -05:00
Keith Nash
7f6792d6e3
Fixed problem identifying some mechanical drives as SSDs
Added -x option to control the badblocks -e option, allowing extended testing.
Added smartctl to the list of dependencies.
Changed disk type detection so that we assume all drives are mechanical drives
unless they explicitly return 'Solid State Drive' for Rotational Rate.
Removed datestamp from every line of log output, only emitting it in log headers.
Minor reformatting.
2020-10-05 23:41:41 -05:00
Keith Nash
84134fe241
Merge pull request #8 from schnerring/master
Add dry_run_wrapper(), update docs, improve option parsing, add detection for mechanical drives
2020-09-09 23:22:30 -05:00
Michael Schnerring
9a211d13e8 update help text 2020-09-10 00:41:54 +02:00
Michael Schnerring
5c2d3feb99 add up-to-date dry-run sample log 2020-09-09 22:02:47 +02:00
Michael Schnerring
f5b2fba114 fix dry_run_wrapper() 2020-09-09 19:53:18 +02:00
Michael Schnerring
bfa816c68b query "Model Number" when getting disk model 2020-09-09 19:14:31 +02:00
Michael Schnerring
31def99394 fix grep redirection
fix grep regexes
2020-09-09 19:14:16 +02:00
Michael Schnerring
a9ce30c92a skip badblocks for non-mechanical drives 2020-09-09 18:59:20 +02:00
Michael Schnerring
c5b193f76c add changes to VERSION history 2020-09-09 18:23:48 +02:00
Michael Schnerring
76fd4bd50d implement dry_run_wrapper() 2020-09-09 18:09:00 +02:00
Michael Schnerring
cd16bc6cd6 decouple by splitting code into smaller functions 2020-09-09 17:59:59 +02:00
Michael Schnerring
53c9d579a7 make <disk> option more resilient by also allowing /dev/ prefix 2020-09-09 17:58:55 +02:00
Michael Schnerring
aafc497863 add docs from file header to help text
add -e option for "extended" help text
move option parsing to the top to be able to always display help text
add Tiny Core Linux 11.1 to tested OS; add IronWolf HDD to tested HDDs
consolidate help text and README.md
2020-09-09 17:58:25 +02:00
Keith Nash
1499e729ec
Merge pull request #7 from schnerring/master
Remove code duplication and dependencies; improve portability, readability and docs; add option parsing, dependency and sudo check
2020-09-09 00:39:03 -05:00
Michael Schnerring
d31b60bfcd remove --captive option from smart tests 2020-09-09 02:19:26 +02:00
Michael Schnerring
5d702df0a6 change constant names to uppercase
regroup constants logically together
2020-09-09 01:52:03 +02:00
Michael Schnerring
57f8dd5227 implement option parsing
* -h for help text
* -f for non-dry mode
* -o <directory> to specify log directory
2020-09-09 00:31:33 +02:00
Michael Schnerring
4a8d44e6a8 check if running as root 2020-09-08 23:00:35 +02:00
Michael Schnerring
0dc4614b3a adjust informational output for readability
remove duplicate output of drive information
add OS_FLAVOR and HOSTNAME constants
2020-09-08 22:52:01 +02:00
Michael Schnerring
0dcbdcf12c make constants readonly 2020-09-08 22:51:29 +02:00
Michael Schnerring
fb842ea127 use long smartctl options to improve readability
run smartctl --test in --captive mode
remove smart test code duplication
add function documentation
2020-09-08 22:50:45 +02:00
Michael Schnerring
3a21b21eca refactor logging
use printf instead of echo to improve portability
rename echo_str to log_info
create log_header function to reduce code duplication
2020-09-08 21:45:19 +02:00
Michael Schnerring
8b3c16cebf implement dependency check 2020-09-08 21:22:57 +02:00
Michael Schnerring
cfaedeac28 simplify and document poll_selftest_complete() 2020-09-08 21:18:11 +02:00
Michael Schnerring
40e114da98 rename duration parameters for expressiveness
add more detailed comments to duration parameters
2020-09-08 21:17:26 +02:00
Michael Schnerring
492e4ca429 remove dependency on pcregrep and tr
move SMART info querying to well documented functions for readability
2020-09-08 21:16:36 +02:00
Michael Schnerring
8744bbd5d0 fix markdownlint issues in README.md 2020-09-08 16:00:29 +02:00
Michael Schnerring
0b36a8658a add .editorconfig; remove trailing whitespace
add myself to license.txt
2020-09-08 16:00:05 +02:00
Keith Nash
f07f20a864
Update disk-burnin.sh 2020-08-19 17:13:20 -05:00
Keith Nash
bea27b48d6
Update README.md 2020-08-19 17:11:02 -05:00
Keith Nash
dc8a503f1c
Update README.md 2020-08-19 17:09:38 -05:00
Keith Nash
cb720c91e1
Changed several default settings
Changed Dry_Run value so that dry runs are no longer the default setting.
Changed badblocks call to exit immediately on first error.
Set logging directoryto current working directory using pwd command.
Reduced default tests so that we run:
 1> Short SMART test
 2> badblocks
 3> Extended SMART test
2020-08-19 16:32:40 -05:00
Keith Nash
8786548073
Update README.md 2020-06-20 23:12:55 -05:00
Keith Nash
8dfbd1f512
Update README.md 2020-06-20 23:11:42 -05:00
Keith Nash
c4f58e5c15
Update README.md 2020-06-20 23:09:11 -05:00
Keith Nash
10541d2986
Update to include info about ioctl warning on FreeBSD 2020-06-20 23:07:10 -05:00