mirror of
https://github.com/Spearfoot/disk-burnin-and-testing.git
synced 2026-10-25 18:40:12 -04:00
Compare commits
12 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d1d38324f | ||
|
|
db713b46a4 | ||
|
|
0675845f0c | ||
|
|
7ff8c08416 | ||
|
|
52a934b5f8 | ||
|
|
66c5bb6d52 | ||
|
|
aede45b87d | ||
|
|
43b4a05522 | ||
|
|
a68e2ae834 | ||
|
|
bc7d0e0e87 | ||
|
|
2ef13143a5 | ||
|
|
ee67da83ab |
2 changed files with 45 additions and 10 deletions
16
README.md
16
README.md
|
|
@ -25,7 +25,7 @@ The script calls `sleep` after starting each SMART test, using a duration based
|
|||
Full SMART information is pulled after each SMART test. All output except for the `sleep` command is echoed to both the screen and log file.
|
||||
|
||||
You should periodically monitor the burn-in progress and check for errors, particularly any errors reported by `badblocks`, or these SMART errors:
|
||||
|
||||
|
||||
|ID|Attribute Name|
|
||||
|---:|---|
|
||||
| 5|Reallocated_Sector_Ct|
|
||||
|
|
@ -41,8 +41,10 @@ The script extracts the drive model and serial number and creates a log filename
|
|||
|
||||
`badblocks` is invoked with the following options:
|
||||
|
||||
* `-b 4096` : Use a block size of 4096
|
||||
* `-b 8192` : Use a block size of 8192 (override this setting with the `-b` option below)
|
||||
* `-c 64` : Number of concurrent blocks to check (override this setting with the `-c` option below, but beware of memory use with high values)
|
||||
* `-e 1` : Abort the `badblocks` test immediately if an error is found (override this setting with the `-x` option below)
|
||||
* `-p 0` : number of consecutive scans without bad blocks required (override this setting with the `-p` option below, but beware of execution time with high values)
|
||||
* `-v` : Verbose mode
|
||||
* `-o` : Write list of bad blocks found (if any) to a file named `burnin-[model]_[serial number].bb`
|
||||
* `-s` : Show progress
|
||||
|
|
@ -50,14 +52,17 @@ The script extracts the drive model and serial number and creates a log filename
|
|||
|
||||
## Usage
|
||||
|
||||
`./disk-burnin.sh [-h] [-e] [-f] [-o <directory>] [-x] <disk>`
|
||||
`./disk-burnin.sh [-h] [-e] [-b <block_size>] [-c <num_blocks>] [-f] [-o <directory>] [-p <num_passes>] [-x] <disk>`
|
||||
|
||||
### Options
|
||||
|
||||
* `-h`: show help text
|
||||
* `-e`: show extended help text
|
||||
* `-b`: block size (default: 8192)
|
||||
* `-c`: number of concurrent blocks to check (default: 64). Higher values will use more memory.
|
||||
* `-f`: run a full, destructive test. Disables the default 'dry-run mode'. **ALL DATA ON THE DISK WILL BE LOST!**
|
||||
* `-o <directory>`: write log files to `<directory>` (default: working directory `$(pwd)`)
|
||||
* `-p <num_passes>`: number of consecutive scans without bad blocks required (default: 0)
|
||||
* `-x`: perform a full pass of `badblocks`, using the `-e 0` option.
|
||||
* `<disk>`: disk to burn-in (`/dev/` may be omitted)
|
||||
|
||||
|
|
@ -97,6 +102,7 @@ Tested under:
|
|||
* Ubuntu Server 16.04.2 LTS
|
||||
* CentOS 7.0
|
||||
* Tiny Core Linux 11.1
|
||||
* Fedora 33 Workstation
|
||||
|
||||
## Drive Models Tested
|
||||
|
||||
|
|
@ -116,8 +122,10 @@ The script should run successfully on any SAS or SATA disk with SMART capabiliti
|
|||
* Re (WD4000FYYZ)
|
||||
* Green
|
||||
* Red
|
||||
* WD140EDFZ
|
||||
* Seagate
|
||||
* IronWolf NAS HDD 12TB (ST12000VN0008)
|
||||
* IronWolf NAS HDD 8TB (ST8000NE001-2M7101)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
|
@ -130,4 +138,4 @@ Tested with the static analysis tool at [www.shellcheck.net](https://www.shellch
|
|||
## Author
|
||||
|
||||
Original author: Keith Nash, March 2017.
|
||||
Modified on 5 October 2020.
|
||||
Modified on 19 February 2021.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ readonly USAGE=\
|
|||
$(basename "$0") -- disk burn-in program
|
||||
|
||||
SYNOPSIS
|
||||
$(basename "$0") [-h] [-e] [-f] [-o <directory>] [-x] <disk>
|
||||
$(basename "$0") [-h] [-b <block_size>] [-c <num_blocks>] [-e] [-f] [-o <directory>] [-p <num_passes>] [-x] <disk>
|
||||
|
||||
DESCRIPTION
|
||||
A script to simplify the process of burning-in disks. Only intended for use
|
||||
|
|
@ -46,9 +46,12 @@ DESCRIPTION
|
|||
OPTIONS
|
||||
-h Show help text
|
||||
-e Show extended help text
|
||||
-b <block_size> Override block size (default is 8192)
|
||||
-c <num_blocks> Override concurrent number of blocks tested (default is 64)
|
||||
-f Force script to run in destructive mode
|
||||
ALL DATA ON THE DISK WILL BE LOST!
|
||||
-o <directory> Write log files to <directory> (default: $(pwd))
|
||||
-p <num_passes> Override number of consecutive scans without bad blocks required (default is 0)
|
||||
-x Run full pass of badblocks instead of exiting on first error
|
||||
<disk> Disk to burn-in (/dev/ may be omitted)
|
||||
|
||||
|
|
@ -119,7 +122,7 @@ NOTES
|
|||
The script extracts the drive model and serial number and forms a log file-
|
||||
name of the form 'burnin-[model]_[serial number].log'.
|
||||
|
||||
badblocks is invoked with a block size of 4096, the -wsv options, and the
|
||||
badblocks is invoked with a block size of 8192, the -wsv options, and the
|
||||
-o option to instruct it to write the list of bad blocks found (if any) to
|
||||
a file named 'burnin-[model]_[serial number].bb'.
|
||||
|
||||
|
|
@ -218,13 +221,28 @@ VERSIONS
|
|||
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."
|
||||
Minor reformatting.
|
||||
|
||||
KY, 30 May 2022
|
||||
Added -b & -c options to control respective badblocks options.
|
||||
|
||||
MH, 28 Jul 2026
|
||||
Added -p option to control corresponding badblocks option."
|
||||
|
||||
# badblocks default -e option is 1, stop testing if a single error occurs
|
||||
BB_E_ARG=1
|
||||
|
||||
# badblocks default -b option is 1024, but we default to 8192. This allows overriding if desired.
|
||||
BB_B_ARG=8192
|
||||
|
||||
# badblocks default -c option is 64. This allows overriding if desired.
|
||||
BB_C_ARG=64
|
||||
|
||||
# badblocks default -p option is 0. This allows overriding if desired.
|
||||
BB_P_ARG=0
|
||||
|
||||
# parse options
|
||||
while getopts ':hefo:x' option; do
|
||||
while getopts ':hefo:b:c:p:x' option; do
|
||||
case "${option}" in
|
||||
h) echo "${USAGE}"
|
||||
exit
|
||||
|
|
@ -237,7 +255,13 @@ while getopts ':hefo:x' option; do
|
|||
;;
|
||||
o) LOG_DIR="${OPTARG}"
|
||||
;;
|
||||
x) BB_E_ARG=0
|
||||
b) BB_B_ARG="${OPTARG}"
|
||||
;;
|
||||
c) BB_C_ARG="${OPTARG}"
|
||||
;;
|
||||
p) BB_P_ARG="${OPTARG}"
|
||||
;;
|
||||
x) BB_E_ARG=0
|
||||
;;
|
||||
:) printf 'Missing argument for -%s\n' "${OPTARG}" >&2
|
||||
echo "${USAGE}" >&2
|
||||
|
|
@ -262,6 +286,9 @@ fi
|
|||
################################################################################
|
||||
|
||||
readonly BB_E_ARG
|
||||
readonly BB_B_ARG
|
||||
readonly BB_C_ARG
|
||||
readonly BB_P_ARG
|
||||
|
||||
# Drive to burn-in
|
||||
DRIVE="$1"
|
||||
|
|
@ -559,7 +586,7 @@ run_smart_test() {
|
|||
run_badblocks_test() {
|
||||
log_header "Running badblocks test"
|
||||
if [ "${DISK_TYPE}" != "SSD" ]; then
|
||||
dry_run_wrapper "badblocks -b 4096 -wsv -e ${BB_E_ARG} -o \"${BB_File}\" \"${DRIVE}\""
|
||||
dry_run_wrapper "badblocks -b ${BB_B_ARG} -wsv -c ${BB_C_ARG} -e ${BB_E_ARG} -o \"${BB_File}\" -p ${BB_P_ARG} \"${DRIVE}\""
|
||||
else
|
||||
log_info "SKIPPED: badblocks for ${DISK_TYPE} device"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue