Disk Burn-in and Testing Script

disk-burnin.sh is a POSIX-compliant shell script designed to simplify and automate the process of burning-in and testing storage drives. It is intended for use on drives that do not contain any data, such as new disks or those being repurposed.

This script orchestrates a series of industry-standard tools like smartctl and badblocks to perform a comprehensive, destructive test suite on a target drive, logging all results for later analysis.

Core Features

  • Automated Test Sequence: Runs a standard sequence of a SMART short test, a full destructive badblocks write-test, and a final SMART extended test.
  • Destructive Testing: Thoroughly checks every block on the drive by writing multiple patterns, ensuring the entire surface is validated.
  • SMART Monitoring: Integrates with smartmontools to initiate self-tests and capture detailed drive health information.
  • Detailed Logging: Creates comprehensive log files for each drive, named with the drive's model and serial number for easy identification.
  • Safety First (Dry-Run Mode): Defaults to a 'dry-run' mode to show the exact commands that will be executed without actually running them, preventing accidental data loss.
  • Cross-Platform: Designed to be POSIX-compliant and tested on a variety of Linux distributions and FreeBSD/FreeNAS.

Critical Warning: Data Destruction

This script runs badblocks in a destructive write-mode (-w option), which completely erases all data on the target disk. This action is irreversible.


DANGER: ALL DATA ON THE DISK WILL BE LOST!

Please be absolutely certain you are targeting the correct drive and that it contains no valuable data. The script defaults to a safe dry-run mode; you must explicitly use the -f flag to enable destructive operations.