From aede45b87d937ae05f6e52f1992e583ab4ff10f0 Mon Sep 17 00:00:00 2001 From: hogenf Date: Sat, 9 Oct 2021 17:48:28 +0200 Subject: [PATCH 1/4] Update notes on badblocks block size to 8192 --- disk-burnin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk-burnin.sh b/disk-burnin.sh index 2efde43..be099be 100755 --- a/disk-burnin.sh +++ b/disk-burnin.sh @@ -119,7 +119,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'. From 52a934b5f81552da84f830383489e98a36ceeec6 Mon Sep 17 00:00:00 2001 From: kyounger Date: Mon, 30 May 2022 09:12:40 -0500 Subject: [PATCH 2/4] Allow -c arg override in badblocks run --- README.md | 6 ++++-- disk-burnin.sh | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d0ce6f4..446d3df 100644 --- a/README.md +++ b/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| @@ -43,6 +43,7 @@ The script extracts the drive model and serial number and creates a log filename * `-b 8192` : Use a block size of 8192 * `-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) * `-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,12 +51,13 @@ The script extracts the drive model and serial number and creates a log filename ## Usage -`./disk-burnin.sh [-h] [-e] [-f] [-o ] [-x] ` +`./disk-burnin.sh [-h] [-e] [-c ] [-f] [-o ] [-x] ` ### Options * `-h`: show help text * `-e`: show extended help text +* `-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 `: write log files to `` (default: working directory `$(pwd)`) * `-x`: perform a full pass of `badblocks`, using the `-e 0` option. diff --git a/disk-burnin.sh b/disk-burnin.sh index be099be..89d96ac 100755 --- a/disk-burnin.sh +++ b/disk-burnin.sh @@ -29,7 +29,7 @@ readonly USAGE=\ $(basename "$0") -- disk burn-in program SYNOPSIS - $(basename "$0") [-h] [-e] [-f] [-o ] [-x] + $(basename "$0") [-h] [-c ] [-e] [-f] [-o ] [-x] 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 Override concurrent number of blocks tested -f Force script to run in destructive mode ALL DATA ON THE DISK WILL BE LOST! -o Write log files to (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 From 7ff8c08416e6372f1642d29aa9bb2df2c269dbb9 Mon Sep 17 00:00:00 2001 From: kyounger Date: Mon, 30 May 2022 10:14:33 -0500 Subject: [PATCH 3/4] Allow -b arg override in badblocks run --- README.md | 5 +++-- disk-burnin.sh | 15 +++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 446d3df..406a1d0 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ 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 +* `-b 8192` : Use a block size of 8192 (override this setting with the `-b` option below) * `-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) * `-v` : Verbose mode @@ -51,12 +51,13 @@ The script extracts the drive model and serial number and creates a log filename ## Usage -`./disk-burnin.sh [-h] [-e] [-c ] [-f] [-o ] [-x] ` +`./disk-burnin.sh [-h] [-e] [-b ] [-c ] [-f] [-o ] [-x] ` ### 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 `: write log files to `` (default: working directory `$(pwd)`) diff --git a/disk-burnin.sh b/disk-burnin.sh index 89d96ac..9021e32 100755 --- a/disk-burnin.sh +++ b/disk-burnin.sh @@ -29,7 +29,7 @@ readonly USAGE=\ $(basename "$0") -- disk burn-in program SYNOPSIS - $(basename "$0") [-h] [-c ] [-e] [-f] [-o ] [-x] + $(basename "$0") [-h] [-b ] [-c ] [-e] [-f] [-o ] [-x] 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 + -b Override block size (defaults to 8192) -c Override concurrent number of blocks tested -f Force script to run in destructive mode ALL DATA ON THE DISK WILL BE LOST! @@ -222,16 +223,19 @@ VERSIONS Minor reformatting. KY, 30 May 2022 - Added -c option to control the badblocks -c option." + Added -b & -c options to control respective badblocks options." # 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, and this allows overriding BB_C_ARG=64 # parse options -while getopts ':hefo:c:x' option; do +while getopts ':hefo:b:c:x' option; do case "${option}" in h) echo "${USAGE}" exit @@ -244,6 +248,8 @@ while getopts ':hefo:c:x' option; do ;; o) LOG_DIR="${OPTARG}" ;; + b) BB_B_ARG="${OPTARG}" + ;; c) BB_C_ARG="${OPTARG}" ;; x) BB_E_ARG=0 @@ -271,6 +277,7 @@ fi ################################################################################ readonly BB_E_ARG +readonly BB_B_ARG readonly BB_C_ARG # Drive to burn-in @@ -569,7 +576,7 @@ run_smart_test() { run_badblocks_test() { log_header "Running badblocks test" if [ "${DISK_TYPE}" != "SSD" ]; then - dry_run_wrapper "badblocks -b 8192 -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}\" \"${DRIVE}\"" else log_info "SKIPPED: badblocks for ${DISK_TYPE} device" fi From db713b46a45f7448d62a156fe58d1cc22495d6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Hj=C3=A4rtstr=C3=B6m?= Date: Tue, 28 Jul 2026 10:33:06 +0200 Subject: [PATCH 4/4] Allow -p arg override in badblocks run --- README.md | 6 ++++-- disk-burnin.sh | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 406a1d0..8110bf2 100644 --- a/README.md +++ b/README.md @@ -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 ] [-c ] [-f] [-o ] [-x] ` +`./disk-burnin.sh [-h] [-e] [-b ] [-c ] [-f] [-o ] [-p ] [-x] ` ### 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 `: write log files to `` (default: working directory `$(pwd)`) +* `-p `: number of consecutive scans without bad blocks required (default: 0) * `-x`: perform a full pass of `badblocks`, using the `-e 0` option. * ``: disk to burn-in (`/dev/` may be omitted) diff --git a/disk-burnin.sh b/disk-burnin.sh index 9021e32..8a4c9bf 100755 --- a/disk-burnin.sh +++ b/disk-burnin.sh @@ -29,7 +29,7 @@ readonly USAGE=\ $(basename "$0") -- disk burn-in program SYNOPSIS - $(basename "$0") [-h] [-b ] [-c ] [-e] [-f] [-o ] [-x] + $(basename "$0") [-h] [-b ] [-c ] [-e] [-f] [-o ] [-p ] [-x] 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 Override block size (defaults to 8192) - -c Override concurrent number of blocks tested + -b Override block size (default is 8192) + -c 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 Write log files to (default: $(pwd)) + -p 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 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