mirror of
https://github.com/Spearfoot/disk-burnin-and-testing.git
synced 2025-12-05 23:53:31 +00:00
Allow -c arg override in badblocks run
This commit is contained in:
@@ -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] [-c <num_blocks>] [-e] [-f] [-o <directory>] [-x] <disk>
|
||||
|
||||
DESCRIPTION
|
||||
A script to simplify the process of burning-in disks. Only intended for use
|
||||
@@ -46,6 +46,7 @@ DESCRIPTION
|
||||
OPTIONS
|
||||
-h Show help text
|
||||
-e Show extended help text
|
||||
-c <num_blocks> Override concurrent number of blocks tested
|
||||
-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))
|
||||
@@ -218,13 +219,19 @@ 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 -c option to control the badblocks -c option."
|
||||
|
||||
# badblocks default -e option is 1, stop testing if a single error occurs
|
||||
BB_E_ARG=1
|
||||
|
||||
# badblocks default -c option is 64, and this allows overriding
|
||||
BB_C_ARG=64
|
||||
|
||||
# parse options
|
||||
while getopts ':hefo:x' option; do
|
||||
while getopts ':hefo:c:x' option; do
|
||||
case "${option}" in
|
||||
h) echo "${USAGE}"
|
||||
exit
|
||||
@@ -237,7 +244,9 @@ while getopts ':hefo:x' option; do
|
||||
;;
|
||||
o) LOG_DIR="${OPTARG}"
|
||||
;;
|
||||
x) BB_E_ARG=0
|
||||
c) BB_C_ARG="${OPTARG}"
|
||||
;;
|
||||
x) BB_E_ARG=0
|
||||
;;
|
||||
:) printf 'Missing argument for -%s\n' "${OPTARG}" >&2
|
||||
echo "${USAGE}" >&2
|
||||
@@ -262,6 +271,7 @@ fi
|
||||
################################################################################
|
||||
|
||||
readonly BB_E_ARG
|
||||
readonly BB_C_ARG
|
||||
|
||||
# Drive to burn-in
|
||||
DRIVE="$1"
|
||||
@@ -559,7 +569,7 @@ run_smart_test() {
|
||||
run_badblocks_test() {
|
||||
log_header "Running badblocks test"
|
||||
if [ "${DISK_TYPE}" != "SSD" ]; then
|
||||
dry_run_wrapper "badblocks -b 8192 -wsv -e ${BB_E_ARG} -o \"${BB_File}\" \"${DRIVE}\""
|
||||
dry_run_wrapper "badblocks -b 8192 -wsv -c ${BB_C_ARG} -e ${BB_E_ARG} -o \"${BB_File}\" \"${DRIVE}\""
|
||||
else
|
||||
log_info "SKIPPED: badblocks for ${DISK_TYPE} device"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user