mirror of
https://github.com/Spearfoot/disk-burnin-and-testing.git
synced 2026-10-25 18:40:12 -04:00
Allow -p arg override in badblocks run
This commit is contained in:
parent
0675845f0c
commit
db713b46a4
2 changed files with 21 additions and 9 deletions
|
|
@ -42,8 +42,9 @@ The script extracts the drive model and serial number and creates a log filename
|
|||
`badblocks` is invoked with the following options:
|
||||
|
||||
* `-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)
|
||||
* `-c 64` : Number of concurrent blocks to check. (override this setting with the `-c` option below, but beware of memory use with high values)
|
||||
* `-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
|
||||
|
|
@ -51,7 +52,7 @@ The script extracts the drive model and serial number and creates a log filename
|
|||
|
||||
## Usage
|
||||
|
||||
`./disk-burnin.sh [-h] [-e] [-b <block_size>] [-c <num_blocks>] [-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
|
||||
|
||||
|
|
@ -61,6 +62,7 @@ The script extracts the drive model and serial number and creates a log filename
|
|||
* `-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)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ readonly USAGE=\
|
|||
$(basename "$0") -- disk burn-in program
|
||||
|
||||
SYNOPSIS
|
||||
$(basename "$0") [-h] [-b <block_size>] [-c <num_blocks>] [-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,11 +46,12 @@ DESCRIPTION
|
|||
OPTIONS
|
||||
-h Show help text
|
||||
-e Show extended help text
|
||||
-b <block_size> Override block size (defaults to 8192)
|
||||
-c <num_blocks> Override concurrent number of blocks tested
|
||||
-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)
|
||||
|
||||
|
|
@ -223,7 +224,10 @@ VERSIONS
|
|||
Minor reformatting.
|
||||
|
||||
KY, 30 May 2022
|
||||
Added -b & -c options to control respective badblocks options."
|
||||
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
|
||||
|
|
@ -231,11 +235,14 @@ 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, and this allows overriding
|
||||
# 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:b:c:x' option; do
|
||||
while getopts ':hefo:b:c:p:x' option; do
|
||||
case "${option}" in
|
||||
h) echo "${USAGE}"
|
||||
exit
|
||||
|
|
@ -252,6 +259,8 @@ while getopts ':hefo:b:c:x' option; do
|
|||
;;
|
||||
c) BB_C_ARG="${OPTARG}"
|
||||
;;
|
||||
p) BB_P_ARG="${OPTARG}"
|
||||
;;
|
||||
x) BB_E_ARG=0
|
||||
;;
|
||||
:) printf 'Missing argument for -%s\n' "${OPTARG}" >&2
|
||||
|
|
@ -279,6 +288,7 @@ fi
|
|||
readonly BB_E_ARG
|
||||
readonly BB_B_ARG
|
||||
readonly BB_C_ARG
|
||||
readonly BB_P_ARG
|
||||
|
||||
# Drive to burn-in
|
||||
DRIVE="$1"
|
||||
|
|
@ -576,7 +586,7 @@ run_smart_test() {
|
|||
run_badblocks_test() {
|
||||
log_header "Running badblocks test"
|
||||
if [ "${DISK_TYPE}" != "SSD" ]; then
|
||||
dry_run_wrapper "badblocks -b ${BB_B_ARG} -wsv -c ${BB_C_ARG} -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