Skip to content

Commit

Permalink
add .editorconfig; remove trailing whitespace
Browse files Browse the repository at this point in the history
add myself to license.txt
  • Loading branch information
schnerring committed Sep 8, 2020
1 parent f07f20a commit 0b36a86
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 25 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
47 changes: 23 additions & 24 deletions disk-burnin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# 2> Run times for large disks can take several days to complete, so it
# is a good idea to use tmux sessions to prevent mishaps.
# is a good idea to use tmux sessions to prevent mishaps.
#
# 3> Must be run as 'root'.
#
#
# 4> Tests of large drives can take days to complete: use tmux!
#
# Performs these steps:
Expand All @@ -30,7 +30,7 @@
# 2> Run badblocks
# 3> Run SMART extended test
#
# The script sleeps after starting each SMART test, using a duration
# The script sleeps after starting each SMART test, using a duration
# based on the polling interval reported by the disk, after which the
# script will poll the disk to verify the self-test has completed.
#
Expand All @@ -40,10 +40,10 @@
# You should monitor the burn-in progress and watch for errors, particularly
# any errors reported by badblocks, or these SMART errors:
#
# 5 Reallocated_Sector_Ct
# 196 Reallocated_Event_Count
# 197 Current_Pending_Sector
# 198 Offline_Uncorrectable
# 5 Reallocated_Sector_Ct
# 196 Reallocated_Event_Count
# 197 Current_Pending_Sector
# 198 Offline_Uncorrectable
#
# These indicate possible problems with the drive. You therefore may
# wish to abort the remaining tests and proceed with an RMA exchange
Expand All @@ -55,28 +55,28 @@
#
# badblocks is invoked with a block size of 4096, 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'.
#
# any) to a file named 'burnin-[model]_[serial number].bb'.
#
# The only required command-line argument is the device specifier, e.g.:
#
# ./disk-burnin.sh sda
# ./disk-burnin.sh sda
#
# ...will run the burn-in test on device /dev/sda
#
# You can run the script in 'dry run mode' (see below) to check the sleep
# duration calculations and to insure that the sequence of commands suits
# your needs. In 'dry runs' the script does not actually perform any
# your needs. In 'dry runs' the script does not actually perform any
# SMART tests or invoke the sleep or badblocks programs. The script is
# distributed with 'dry runs' enabled, so you will need to edit the
# Dry_Run variable below, setting it to 0, in order to actually perform
# tests on drives.
#
#
# Before using the script on FreeBSD systems (including FreeNAS) you must
# first execute this sysctl command to alter the kernel's geometry debug
# flags. This allows badblocks to write to the entire disk:
#
# sysctl kern.geom.debugflags=0x10
#
#
# Tested under:
# FreeNAS 9.10.2 (FreeBSD 10.3-STABLE)
# Ubuntu Server 16.04.2 LTS
Expand All @@ -94,24 +94,24 @@
# Uses: grep, pcregrep, awk, sed, tr, sleep, badblocks
#
# Written by Keith Nash, March 2017
#
#
# KN, 8 Apr 2017:
# Added minimum test durations because some devices don't return accurate values.
# Added code to clean up the log file, removing copyright notices, etc.
# No longer echo 'smartctl -t' output to log file as it imparts no useful information.
# Emit test results after tests instead of full 'smartctl -a' output.
# Emit full 'smartctl -x' output at the end of all testing.
# Minor changes to log output and formatting.
#
#
# KN, 12 May 2017:
# Added code to poll the disk and check for completed self-tests.
#
#
# As noted above, some disks don't report accurate values for the short and extended
# self-test intervals, sometimes by a significant amount. The original approach using
# self-test intervals, sometimes by a significant amount. The original approach using
# 'fudge' factors wasn't reliable and the script would finish even though the SMART
# self-tests had not completed. The new polling code helps insure that this doesn't
# happen.
#
#
# Fixed code to work around annoying differences between sed's behavior on Linux and
# FreeBSD.
#
Expand All @@ -128,7 +128,7 @@
# 1> Short SMART test
# 2> badblocks
# 3> Extended SMART test
#
#
########################################################################

if [ $# -ne 1 ]; then
Expand All @@ -144,7 +144,7 @@ Drive=$1

Dry_Run=0

# Directory specifiers for log and badblocks data files. Leave off the
# Directory specifiers for log and badblocks data files. Leave off the
# trailing slash if you specify a value. Default is the current working
# directory.

Expand Down Expand Up @@ -227,15 +227,15 @@ poll_selftest_complete()
# Return 0 if the test has completed, 1 if we exceed our polling timeout interval

while [ $l_done -eq 0 ];
do
do
smartctl -a /dev/"$Drive" | grep -i "The previous self-test routine completed" > /dev/null 2<&1
l_status=$?
if [ $l_status -eq 0 ]; then
echo_str "SMART self-test complete"
l_rv=0
l_done=1
else
# Check for failure
# Check for failure
smartctl -a /dev/"$Drive" | grep -i "of the test failed." > /dev/null 2<&1
l_status=$?
if [ $l_status -eq 0 ]; then
Expand All @@ -255,7 +255,7 @@ poll_selftest_complete()
done

return $l_rv
}
}

run_short_test()
{
Expand Down Expand Up @@ -367,4 +367,3 @@ if [ "${osflavor}" = "FreeBSD" ]; then
sed -i '' -e '/Vendor Specific SMART/d' "${Log_File}"
sed -i '' -e '/SMART Error Log Version/d' "${Log_File}"
fi

3 changes: 2 additions & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2017 by Keith Nash
Original work Copyright (c) 2017 by Keith Nash
Modified work Copyright (c) 2020 by Michael Schnerring

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 0b36a86

Please sign in to comment.