Usage Guide
This page provides a detailed explanation of the script's command-line options, test sequence, and output files.
Synopsis
$(basename "$0") [-h] [-b <block_size>] [-c <num_blocks>] [-e] [-f] [-o <directory>] [-x] <disk>
Command-Line Options
The script's behavior can be customized with the following options:
Option | Description | Default |
---|---|---|
-h |
Show the standard help text and exit. | N/A |
-e |
Show extended help text, including notes on test interpretation and history, and exit. | N/A |
-f |
Force destructive mode. This disables the default dry-run mode and executes the tests. | Dry-run mode |
-o <directory> |
Write the output log and badblocks files to the specified directory. | Current pwd |
-b <block_size> |
Set the block size for the badblocks test in bytes. |
8192 |
-c <num_blocks> |
Set the number of blocks to test in parallel during the badblocks test. Higher values use more RAM. |
64 |
-x |
Run a full pass of badblocks instead of exiting on the first error (-e 0 for badblocks ). |
Exit on first error |
<disk> |
The target disk to test (e.g., sda or /dev/sda ). This is a required argument. |
N/A |
The Test Sequence
The script performs a rigorous, three-stage testing process:
-
SMART Short Test: This is a quick preliminary check of the drive's health. It runs a collection of test routines that check the electrical and mechanical performance as well as the read performance of the disk. This test can quickly identify drives that are clearly failing.
-
badblocks
Destructive Write Test: This is the core of the burn-in process. Thebadblocks
utility is run with the-wsv
options, which performs a write-mode test. It writes four different patterns (0xaa, 0x55, 0xff, 0x00) to every block on the disk and then reads them back to verify integrity. This process is highly effective at finding bad sectors and surface defects. By default, it exits on the first error found, unless the-x
flag is provided. -
SMART Extended Test: After the intense
badblocks
test, a final extended self-test is run. This test performs a full surface scan of the disk without writing to it. It can reveal issues that may have developed during the stress test. This test takes much longer than the short test.
Output Files
For each drive tested, the script generates up to two files named using the drive's model and serial number.
burnin-[model]_[serial_number].log
: The main log file. It contains a complete record of the entire process, including system information, drive details, test commands, SMART test results, and a final full dump of the drive's SMART attributes.burnin-[model]_[serial_number].bb
: The bad blocks file. This file is only created ifbadblocks
finds one or more bad sectors. It contains a list of the block numbers that failed verification.
Example Log File
Here is a snippet from a sample log file, showing the initial setup and the start of the badblocks
test.
[2020-09-09 21:58:23 CEST] +-----------------------------------------------------------------------------
[2020-09-09 21:58:23 CEST] + Started burn-in: Wed Sep 9 21:58:23 CEST 2020
[2020-09-09 21:58:23 CEST] +-----------------------------------------------------------------------------
[2020-09-09 21:58:23 CEST] Host: arch-desktop
[2020-09-09 21:58:23 CEST] OS: Linux
[2020-09-09 21:58:23 CEST] Drive: /dev/sdb
[2020-09-09 21:58:23 CEST] Disk Type: mechanical
[2020-09-09 21:58:23 CEST] Drive Model: SAMSUNG_HD204UI
[2020-09-09 21:58:23 CEST] Serial Number: XXXXXXXXXXXXXX
[2020-09-09 21:58:23 CEST] Short test duration: 2 minutes
[2020-09-09 21:58:23 CEST] 120 seconds
[2020-09-09 21:58:23 CEST] Extended test duration: 341 minutes
[2020-09-09 21:58:23 CEST] 20460 seconds
[2020-09-09 21:58:23 CEST] Log file: ./burnin-SAMSUNG_HD204UI_XXXXXXXXXXXXXX.log
[2020-09-09 21:58:23 CEST] Bad blocks file: ./burnin-SAMSUNG_HD204UI_XXXXXXXXXXXXXX.bb
[2020-09-09 21:58:23 CEST] +-----------------------------------------------------------------------------
[2020-09-09 21:58:23 CEST] + Running SMART short test: Wed Sep 9 21:58:23 CEST 2020
[2020-09-09 21:58:23 CEST] +-----------------------------------------------------------------------------
[...]
[2020-09-09 21:58:23 CEST] +-----------------------------------------------------------------------------
[2020-09-09 21:58:23 CEST] + Running badblocks test: Wed Sep 9 21:58:23 CEST 2020
[2020-09-09 21:58:23 CEST] +-----------------------------------------------------------------------------
[2020-09-09 21:58:23 CEST] DRY RUN: badblocks -b 4096 -wsv -e 1 -o "./burnin-SAMSUNG_HD204UI_XXXXXXXXXXXXXX.bb" "/dev/sdb"
[2020-09-09 21:58:23 CEST] Finished badblocks test
Interpreting Results
Your primary goal is to complete the entire test sequence with zero errors.
badblocks
errors: If the.bb
file is created, it means permanent errors were found on the disk surface. For a new drive, this is a strong indication of a defect and a valid reason to request a replacement (RMA).-
SMART errors: After the test, carefully inspect the SMART attributes in the log file. Pay close attention to the following attributes, as non-zero values can indicate problems:
ID Attribute Name Why It's Important 5 Reallocated_Sector_Ct
Count of remapped sectors. A rising value is a bad sign. 196 Reallocated_Event_Count
Number of remapping operations. 197 Current_Pending_Sector
Unstable sectors awaiting remapping. Should be zero. 198 Offline_Uncorrectable
Count of uncorrectable errors. Should be zero.
Any errors in these areas, especially on a new drive, suggest potential reliability issues.