Stress testing new hard drives in Ubuntu

Most computer new computer hardware that will fail quickly, will fail within the first month of usage, if not sooner.

Given that, it's recommended to do a burn-in test for any new computer hardware, including hard drives.

I've been using a disk burn-in test to stress test hard drives as I've been replacing them in my ZFS pool.

Once they pass the stress test, then they get added to the ZFS pool.

Less time to process a RMA for a drive not in my ZFS pool than to add it to the pool, it fails, then waiting for RMA, only to add it in again.

Most of the stress testing tools for hard drives requires you to boot from a USB stick, which takes my entire NAS out of commission while it runs.

I came across Spearfoot's shell script that does a burn-in test, but using a shell script, which leaves my NAS up and running while the drive is tested.

Download the disk burn-in script:

git clone https://github.com/Spearfoot/disk-burnin-and-testing.git

Perform a dry run of the script

By default, the script only does a dry run, as a non-dry run is destructive to any data on the disk.

sudo disk-burnin-and-testing/disk-burnin.sh /dev/sdc

Run the script

Double and triple check the drive mapping, as this test will destroy ALL data on the disk !!

As this test can take awhile, especially with the 10Tb drives I'm installing, I would suggest using tmux.

sudo disk-burnin-and-testing/disk-burnin.sh -f /dev/sdc

Disk burn-in testing script running

For a 10Tb drive, it takes almost SIX (yes 6) days to run.

  • The smartctl short test takes 2 minutes.

  • The badblocks writes, then reads, 4 different patters to the drive, and each write/read pattern takes 26 hours.

  • Finally the smartctl long test takes 18 hours.

From the resulting burnin log file:

grep "^+" burnin-WDC_WD102KFBX-68M95N0_VHGR4WUM.log
+-----------------------------------------------------------------------------
+ Started burn-in: Sat Feb 18 07:14:17 PM MST 2023
+-----------------------------------------------------------------------------
+-----------------------------------------------------------------------------
+ Running SMART short test: Sat Feb 18 07:14:18 PM MST 2023
+-----------------------------------------------------------------------------
+-----------------------------------------------------------------------------
+ Running badblocks test: Sat Feb 18 07:16:18 PM MST 2023
+-----------------------------------------------------------------------------
+-----------------------------------------------------------------------------
+ Running SMART long test: Thu Feb 23 07:48:01 AM MST 2023
+-----------------------------------------------------------------------------
+-----------------------------------------------------------------------------
+ Drive information: Fri Feb 24 01:33:01 AM MST 2023
+-----------------------------------------------------------------------------
+-----------------------------------------------------------------------------
+ Finished burn-in: Fri Feb 24 01:33:01 AM MST 2023
+-----------------------------------------------------------------------------

Yes, it's a long test to run, but worth the piece of mind that comes with having tested hardware in my NAS.

Full output of the burnin log file:

+-----------------------------------------------------------------------------
+ Started burn-in: Sat Feb 18 07:14:17 PM MST 2023
+-----------------------------------------------------------------------------
Host:                   nas
OS:                     Linux
Drive:                  /dev/sdc
Disk Type:              7200_rpm
Drive Model:            WDC_WD102KFBX-68M95N0
Serial Number:          VHGR4WUM
Short test duration:    2 minutes
                        120 seconds
Extended test duration: 1065 minutes
                        63900 seconds
Log file:               /home/tom/disk-burnin-and-testing/burnin-WDC_WD102KFBX-68M95N0_VHGR4WUM.log
Bad blocks file:        /home/tom/disk-burnin-and-testing/burnin-WDC_WD102KFBX-68M95N0_VHGR4WUM.bb
+-----------------------------------------------------------------------------
+ Running SMART short test: Sat Feb 18 07:14:18 PM MST 2023
+-----------------------------------------------------------------------------
SMART short test started, awaiting completion for 120 seconds ...
SMART self-test succeeded
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-60-generic] (local build)

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%         7         -

Finished SMART short test
+-----------------------------------------------------------------------------
+ Running badblocks test: Sat Feb 18 07:16:18 PM MST 2023
+-----------------------------------------------------------------------------
Finished badblocks test
+-----------------------------------------------------------------------------
+ Running SMART long test: Thu Feb 23 07:48:01 AM MST 2023
+-----------------------------------------------------------------------------
SMART long test started, awaiting completion for 63900 seconds ...
SMART self-test succeeded
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-60-generic] (local build)

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%       132         -
# 2  Short offline       Completed without error       00%         7         -

Finished SMART long test
+-----------------------------------------------------------------------------
+ Drive information: Fri Feb 24 01:33:01 AM MST 2023
+-----------------------------------------------------------------------------
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-60-generic] (local build)

=== START OF INFORMATION SECTION ===
Device Model:     WDC WD102KFBX-68M95N0
Serial Number:    VHGR4WUM
LU WWN Device Id: 5 000cca 0c8ca128c
Firmware Version: 83.00A83
User Capacity:    10,000,831,348,736 bytes [10.0 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Feb 24 01:33:01 2023 MST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM level is:     164 (intermediate level without standby)
Rd look-ahead is: Enabled
Write cache is:   Enabled
DSN feature is:   Unavailable
ATA Security is:  Disabled, NOT FROZEN [SEC1]
Wt Cache Reorder: Enabled

SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82)	Offline data collection activity
					was completed without error.
					Auto Offline Data Collection: Enabled.
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: 		(   87) 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: 	 (1065) minutes.
SCT capabilities: 	       (0x003d)	SCT Status supported.
					SCT Error Recovery Control supported.
					SCT Feature Control supported.
					SCT Data Table supported.

ID# ATTRIBUTE_NAME          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  1 Raw_Read_Error_Rate     PO-R--   100   100   016    -    0
  2 Throughput_Performance  --S---   132   132   054    -    96
  3 Spin_Up_Time            POS---   100   100   024    -    0
  4 Start_Stop_Count        -O--C-   100   100   000    -    2
  5 Reallocated_Sector_Ct   PO--CK   100   100   005    -    0
  7 Seek_Error_Rate         -O-R--   100   100   067    -    0x000000000000
  8 Seek_Time_Performance   --S---   128   128   020    -    18
  9 Power_On_Hours          -O--C-   100   100   000    -    133
 10 Spin_Retry_Count        -O--C-   100   100   060    -    0
 12 Power_Cycle_Count       -O--CK   100   100   000    -    2
192 Power-Off_Retract_Count -O--CK   100   100   000    -    3
193 Load_Cycle_Count        -O--C-   100   100   000    -    3
194 Temperature_Celsius     -O----   176   176   000    -    34 (Min/Max 22/37)
196 Reallocated_Event_Count -O--CK   100   100   000    -    0
197 Current_Pending_Sector  -O---K   100   100   000    -    0
198 Offline_Uncorrectable   ---R--   100   100   000    -    0
199 UDMA_CRC_Error_Count    -O-R--   200   200   000    -    0
                            ||||||_ K auto-keep
                            |||||__ C event count
                            ||||___ R error rate
                            |||____ S speed/performance
                            ||_____ O updated online
                            |______ P prefailure warning

General Purpose Log Directory Version 1
SMART           Log Directory Version 1 [multi-sector log support]
Address    Access  R/W   Size  Description
0x00       GPL,SL  R/O      1  Log Directory
0x01           SL  R/O      1  Summary SMART error log
0x02           SL  R/O      1  Comprehensive SMART error log
0x03       GPL     R/O      1  Ext. Comprehensive SMART error log
0x04       GPL     R/O    256  Device Statistics log
0x04       SL      R/O    255  Device Statistics log
0x06           SL  R/O      1  SMART self-test log
0x07       GPL     R/O      1  Extended self-test log
0x08       GPL     R/O      2  Power Conditions log
0x09           SL  R/W      1  Selective self-test log
0x0c       GPL     R/O   5501  Pending Defects log
0x10       GPL     R/O      1  NCQ Command Error log
0x11       GPL     R/O      1  SATA Phy Event Counters log
0x12       GPL     R/O      1  SATA NCQ Non-Data log
0x13       GPL     R/O      1  SATA NCQ Send and Receive log
0x15       GPL     R/W      1  Rebuild Assist log
0x21       GPL     R/O      1  Write stream error log
0x22       GPL     R/O      1  Read stream error log
0x24       GPL     R/O    256  Current Device Internal Status Data log
0x25       GPL     R/O    256  Saved Device Internal Status Data log
0x2f       GPL     -        1  Set Sector Configuration
0x30       GPL,SL  R/O      9  IDENTIFY DEVICE data log
0x80-0x9f  GPL,SL  R/W     16  Host vendor specific log
0xe0       GPL,SL  R/W      1  SCT Command/Status
0xe1       GPL,SL  R/W      1  SCT Data Transfer

SMART Extended Comprehensive Error Log Version: 1 (1 sectors)
No Errors Logged

SMART Extended Self-test Log Version: 1 (1 sectors)
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%       132         -
# 2  Short offline       Completed without error       00%         7         -

SMART Selective self-test log data structure revision number 1
 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.

SCT Status Version:                  3
SCT Version (vendor specific):       256 (0x0100)
Device State:                        Active (0)
Current Temperature:                    34 Celsius
Power Cycle Min/Max Temperature:     33/37 Celsius
Lifetime    Min/Max Temperature:     22/37 Celsius
Under/Over Temperature Limit Count:   0/0

SCT Temperature History Version:     2
Temperature Sampling Period:         1 minute
Temperature Logging Interval:        1 minute
Min/Max recommended Temperature:      0/60 Celsius
Min/Max Temperature Limit:           -40/70 Celsius
Temperature History Size (Index):    128 (104)

Index    Estimated Time   Temperature Celsius
 105    2023-02-23 23:26    35  ****************
 ...    ..(  6 skipped).    ..  ****************
 112    2023-02-23 23:33    35  ****************
 113    2023-02-23 23:34    34  ***************
 ...    ..( 82 skipped).    ..  ***************
  68    2023-02-24 00:57    34  ***************
  69    2023-02-24 00:58    33  **************
  70    2023-02-24 00:59    34  ***************
 ...    ..( 32 skipped).    ..  ***************
 103    2023-02-24 01:32    34  ***************
 104    2023-02-24 01:33    35  ****************

SCT Error Recovery Control:
           Read:     70 (7.0 seconds)
          Write:     70 (7.0 seconds)

Device Statistics (GP Log 0x04)
Page  Offset Size        Value Flags Description
0x01  =====  =               =  ===  == General Statistics (rev 1) ==
0x01  0x008  4               2  ---  Lifetime Power-On Resets
0x01  0x010  4             133  ---  Power-on Hours
0x01  0x018  6     78131494912  ---  Logical Sectors Written
0x01  0x020  6       152600576  ---  Number of Write Commands
0x01  0x028  6     78131522007  ---  Logical Sectors Read
0x01  0x030  6       152601261  ---  Number of Read Commands
0x01  0x038  6       480455900  ---  Date and Time TimeStamp
0x03  =====  =               =  ===  == Rotating Media Statistics (rev 1) ==
0x03  0x008  4              50  ---  Spindle Motor Power-on Hours
0x03  0x010  4              50  ---  Head Flying Hours
0x03  0x018  4               3  ---  Head Load Events
0x03  0x020  4               0  ---  Number of Reallocated Logical Sectors
0x03  0x028  4               0  ---  Read Recovery Attempts
0x03  0x030  4               0  ---  Number of Mechanical Start Failures
0x04  =====  =               =  ===  == General Errors Statistics (rev 1) ==
0x04  0x008  4               0  ---  Number of Reported Uncorrectable Errors
0x04  0x010  4               0  ---  Resets Between Cmd Acceptance and Completion
0x05  =====  =               =  ===  == Temperature Statistics (rev 1) ==
0x05  0x008  1              34  ---  Current Temperature
0x05  0x010  1              34  N--  Average Short Term Temperature
0x05  0x018  1               -  N--  Average Long Term Temperature
0x05  0x020  1              37  ---  Highest Temperature
0x05  0x028  1              22  ---  Lowest Temperature
0x05  0x030  1              35  N--  Highest Average Short Term Temperature
0x05  0x038  1              25  N--  Lowest Average Short Term Temperature
0x05  0x040  1               -  N--  Highest Average Long Term Temperature
0x05  0x048  1               -  N--  Lowest Average Long Term Temperature
0x05  0x050  4               0  ---  Time in Over-Temperature
0x05  0x058  1              60  ---  Specified Maximum Operating Temperature
0x05  0x060  4               0  ---  Time in Under-Temperature
0x05  0x068  1               0  ---  Specified Minimum Operating Temperature
0x06  =====  =               =  ===  == Transport Statistics (rev 1) ==
0x06  0x008  4               8  ---  Number of Hardware Resets
0x06  0x010  4               2  ---  Number of ASR Events
0x06  0x018  4               0  ---  Number of Interface CRC Errors
0xff  =====  =               =  ===  == Vendor Specific Statistics (rev 1) ==
                                |||_ C monitored condition met
                                ||__ D supports DSN
                                |___ N normalized value

Pending Defects log (GP Log 0x0c)
No Defects Logged

SATA Phy Event Counters (GP Log 0x11)
ID      Size     Value  Description
0x0001  2            0  Command failed due to ICRC error
0x0002  2            0  R_ERR response for data FIS
0x0003  2            0  R_ERR response for device-to-host data FIS
0x0004  2            0  R_ERR response for host-to-device data FIS
0x0005  2            0  R_ERR response for non-data FIS
0x0006  2            0  R_ERR response for device-to-host non-data FIS
0x0007  2            0  R_ERR response for host-to-device non-data FIS
0x0008  2            0  Device-to-host non-data FIS retries
0x0009  2            2  Transition from drive PhyRdy to drive PhyNRdy
0x000a  2            3  Device-to-host register FISes sent due to a COMRESET
0x000b  2            0  CRC errors within host-to-device FIS
0x000d  2            0  Non-CRC errors within host-to-device FIS

+-----------------------------------------------------------------------------
+ Finished burn-in: Fri Feb 24 01:33:01 AM MST 2023
+-----------------------------------------------------------------------------

If you have a new system, you can run this test on each hard drive concurrently.

References

Spearfoot / disk-burnin-and-testing https://github.com/Spearfoot/disk-burnin-and-testing