mirror of
https://github.com/Spearfoot/disk-burnin-and-testing.git
synced 2025-12-15 15:53:16 +00:00
adjust informational output for readability
remove duplicate output of drive information add OS_FLAVOR and HOSTNAME constants
This commit is contained in:
@@ -154,6 +154,10 @@ readonly Drive="$1"
|
|||||||
# running any tests; leave it set to zero to burn-in disks.
|
# running any tests; leave it set to zero to burn-in disks.
|
||||||
readonly Dry_Run=0
|
readonly Dry_Run=0
|
||||||
|
|
||||||
|
# System information
|
||||||
|
readonly HOSTNAME="$(hostname)"
|
||||||
|
readonly OS_FLAVOR="$(uname)"
|
||||||
|
|
||||||
# Directory specifiers for log and badblocks data files. Leave off the trailing
|
# Directory specifiers for log and badblocks data files. Leave off the trailing
|
||||||
# slash if you specify a value. Default is the current working directory.
|
# slash if you specify a value. Default is the current working directory.
|
||||||
readonly Log_Dir="$(pwd)"
|
readonly Log_Dir="$(pwd)"
|
||||||
@@ -329,7 +333,7 @@ poll_selftest_complete()
|
|||||||
##################################################
|
##################################################
|
||||||
run_smart_test()
|
run_smart_test()
|
||||||
{
|
{
|
||||||
log_header "Run SMART $1 test on drive /dev/${Drive}"
|
log_header "Run SMART $1 test"
|
||||||
if [ "${Dry_Run}" -eq 0 ]; then
|
if [ "${Dry_Run}" -eq 0 ]; then
|
||||||
smartctl --test="$1" --captive "/dev/${Drive}"
|
smartctl --test="$1" --captive "/dev/${Drive}"
|
||||||
log_info "SMART $1 test started, awaiting completion for $2 seconds ..."
|
log_info "SMART $1 test started, awaiting completion for $2 seconds ..."
|
||||||
@@ -339,7 +343,7 @@ run_smart_test()
|
|||||||
else
|
else
|
||||||
log_info "Dry run: would start the SMART $1 test and sleep $2 seconds until the test finishes"
|
log_info "Dry run: would start the SMART $1 test and sleep $2 seconds until the test finishes"
|
||||||
fi
|
fi
|
||||||
log_info "Finished SMART short test on drive /dev/${Drive}"
|
log_info "Finished SMART short test"
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
@@ -353,13 +357,13 @@ run_smart_test()
|
|||||||
##################################################
|
##################################################
|
||||||
run_badblocks_test()
|
run_badblocks_test()
|
||||||
{
|
{
|
||||||
log_header "Run badblocks test on drive /dev/${Drive}"
|
log_header "Running badblocks test"
|
||||||
if [ "${Dry_Run}" -eq 0 ]; then
|
if [ "${Dry_Run}" -eq 0 ]; then
|
||||||
badblocks -b 4096 -wsv -e 1 -o "${BB_File}" "/dev/${Drive}"
|
badblocks -b 4096 -wsv -e 1 -o "${BB_File}" "/dev/${Drive}"
|
||||||
else
|
else
|
||||||
log_info "Dry run: would run badblocks -b 4096 -wsv -e 1 -o ${BB_File} /dev/${Drive}"
|
log_info "Dry run: would run badblocks -b 4096 -wsv -e 1 -o ${BB_File} /dev/${Drive}"
|
||||||
fi
|
fi
|
||||||
log_info "Finished badblocks test on drive /dev/${Drive}"
|
log_info "Finished badblocks test"
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
@@ -372,17 +376,17 @@ if [ -e "$Log_File" ]; then
|
|||||||
rm "$Log_File"
|
rm "$Log_File"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_header "Started burn-in of /dev/${Drive}"
|
log_header "Started burn-in"
|
||||||
|
|
||||||
log_info "Host: $(hostname)"
|
log_info "Host: ${HOSTNAME}"
|
||||||
log_info "Drive Model: ${Disk_Model}"
|
log_info "OS Flavor: ${OS_FLAVOR}"
|
||||||
log_info "Serial Number: ${Serial_Number}"
|
log_info "Drive: /dev/${Drive}"
|
||||||
log_info "Short test duration: ${Short_Test_Minutes} minutes"
|
log_info "Drive Model: ${Disk_Model}"
|
||||||
log_info "Short test sleep duration: ${Short_Test_Seconds} seconds"
|
log_info "Serial Number: ${Serial_Number}"
|
||||||
log_info "Extended test duration: ${Extended_Test_Minutes} minutes"
|
log_info "Short test duration: ${Short_Test_Minutes} minutes / ${Short_Test_Seconds} seconds"
|
||||||
log_info "Extended test sleep duration: ${Extended_Test_Seconds} seconds"
|
log_info "Extended test duration: ${Extended_Test_Minutes} minutes / ${Extended_Test_Seconds} seconds"
|
||||||
log_info "Log file: ${Log_File}"
|
log_info "Log file: ${Log_File}"
|
||||||
log_info "Bad blocks file: ${BB_File}"
|
log_info "Bad blocks file: ${BB_File}"
|
||||||
|
|
||||||
# Run the test sequence:
|
# Run the test sequence:
|
||||||
run_smart_test "short" "${Short_Test_Seconds}"
|
run_smart_test "short" "${Short_Test_Seconds}"
|
||||||
@@ -390,16 +394,14 @@ run_badblocks_test
|
|||||||
run_smart_test "long" "${Extended_Test_Seconds}"
|
run_smart_test "long" "${Extended_Test_Seconds}"
|
||||||
|
|
||||||
# Emit full device information to log:
|
# Emit full device information to log:
|
||||||
log_header "SMART information for drive /dev/${Drive}"
|
log_header "SMART and non-SMART information"
|
||||||
smartctl --xall --vendorattribute=7,hex48 "/dev/${Drive}" | tee -a "$Log_File"
|
smartctl --xall --vendorattribute=7,hex48 "/dev/${Drive}" | tee -a "$Log_File"
|
||||||
|
|
||||||
log_header "Finished burn-in of /dev/${Drive}"
|
log_header "Finished burn-in"
|
||||||
|
|
||||||
# Clean up the log file:
|
# Clean up the log file:
|
||||||
|
|
||||||
osflavor="$(uname)"
|
if [ "${OS_FLAVOR}" = "Linux" ]; then
|
||||||
|
|
||||||
if [ "${osflavor}" = "Linux" ]; then
|
|
||||||
sed -i -e '/Copyright/d' "${Log_File}"
|
sed -i -e '/Copyright/d' "${Log_File}"
|
||||||
sed -i -e '/=== START OF READ/d' "${Log_File}"
|
sed -i -e '/=== START OF READ/d' "${Log_File}"
|
||||||
sed -i -e '/SMART Attributes Data/d' "${Log_File}"
|
sed -i -e '/SMART Attributes Data/d' "${Log_File}"
|
||||||
@@ -407,7 +409,7 @@ if [ "${osflavor}" = "Linux" ]; then
|
|||||||
sed -i -e '/SMART Error Log Version/d' "${Log_File}"
|
sed -i -e '/SMART Error Log Version/d' "${Log_File}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${osflavor}" = "FreeBSD" ]; then
|
if [ "${OS_FLAVOR}" = "FreeBSD" ]; then
|
||||||
sed -i '' -e '/Copyright/d' "${Log_File}"
|
sed -i '' -e '/Copyright/d' "${Log_File}"
|
||||||
sed -i '' -e '/=== START OF READ/d' "${Log_File}"
|
sed -i '' -e '/=== START OF READ/d' "${Log_File}"
|
||||||
sed -i '' -e '/SMART Attributes Data/d' "${Log_File}"
|
sed -i '' -e '/SMART Attributes Data/d' "${Log_File}"
|
||||||
|
|||||||
Reference in New Issue
Block a user