Merge remote-tracking branch 'origin/master'

* origin/master:
  Update README.md
  Update README.md
  Update README.md
  Update to include info about ioctl warning on FreeBSD
  Updated applicable OS list
  Bew more lenient when reading serial-numbers
  Update README.md
  Update README.md
  Make dry run issue more prominent
  Update README.md
  Update README.md
  Update README.md
  Update README.md
  Update README.md
  Update README.md
This commit is contained in:
dak180 2020-07-03 20:10:50 -04:00
commit 0a69922735
No known key found for this signature in database
GPG key ID: 6E2DC12780B8BB51
2 changed files with 36 additions and 18 deletions

View file

@ -4,8 +4,9 @@
Be aware that:
* This script runs the `badblocks` program in destructive mode, which erases any data on the disk. Therefore, please be careful! __Do not run this script on disks containing data you value!__
* Run times for large disks can take several days to complete, so it is a good idea to use tmux sessions to prevent mishaps.
* Must be run as 'root'.
* You will need to edit the script and change the `Dry_Run` variable, setting it to 0, in order to actually perform tests on drives (see details below).
* Run times for large disks can take several days to a week or more to complete, so it is a good idea to use tmux sessions to prevent mishaps.
* Must be run as 'root', so either log on using the root account or use the `sudo` command, for example: `sudo ./disk_burnin.sh sda`
Performs these steps:
@ -14,7 +15,9 @@ Performs these steps:
3. Run `badblocks`
4. Run SMART short test
5. Run SMART extended test
I often skip the second step ("2. Run SMART extended test"); you can do the same by deleting or commenting out the call to ``run_extended_test`` at line 324 in the script.
The script sleeps after starting each SMART test, using a duration based on the polling interval reported by the disk, and adding an additional delay to account for discrepancies.
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.
@ -40,23 +43,36 @@ The only required command-line argument is the device specifier, e.g.:
...will run the burn-in test on device /dev/sda
You can run the script in 'dry run mode' 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 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, setting it to 0, in order to actually perform tests on drives.
__IMPORTANT: Dry Run is the default__
Before using the script on FreeBSD systems (including FreeNAS) you must first execute the `sysctl` command below to alter the kernel's geometry debug flags. This allows `badblocks` to write to the entire disk:
The script is distributed with 'dry run mode' enabled. This lets you 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 SMART tests or invoke the `sleep` or `badblocks` programs. __Again, you will need to edit the script and change the `Dry_Run` variable, setting it to 0, in order to actually perform tests on drives.__
Some users with atypical hardware environments may need to modify the script and specify the `smartctl` command device type explictly with the `-d` option. User __bcmryan__ reports success using `-d sat` with a Western Digital MyBook 8TB external drive enclosure.
__FREEBSD/FREENAS NOTES:__
Before using the script on FreeBSD systems (including FreeNAS) you should first execute the `sysctl` command below to alter the kernel's geometry debug flags. This allows `badblocks` to write to the entire disk:
`sysctl kern.geom.debugflags=0x10`
Also note that `badblocks` may issue the following warning under FreeBSD/FreeNAS, which can safely be ignored as it has no effect on testing:
`set_o_direct: Inappropiate ioctl for device`
__OPERATING SYSTEMS__
Tested under:
* FreeNAS 9.10.2-U1 (FreeBSD 10.3-STABLE)
* Ubuntu Server 16.04.2 LTS
Tested on these drives:
* Intel DC S3700 SSD
* Intel Model 320 Series SSD
* HGST Deskstar NAS (HDN724040ALE640)
* Hitachi/HGST Ultrastar 7K4000 (HUS724020ALE640)
* Western Digital Re (WD4000FYYZ)
* Western Digital Black (WD6001FZWX)
* FreeNAS 9.10.2-U1 (FreeBSD 10.3-STABLE)
* FreeNAS 11.1-U7 (FreeBSD 11.1-STABLE)
* FreeNAS 11.2-U8 (FreeBSD 11.2-STABLE)
* Ubuntu Server 16.04.2 LTS
* CentOS 7.0
__DRIVE MODELS__
The script should run successfully on any SATA disk with SMART capabilities, which includes just about all modern drives. It has been tested on these particular devices:
* HGST Deskstar NAS, UltraStar, UltraStar He10, and UltraStar He12 models
* Western Digital Gold, Black, and Re models
Requires the smartmontools, available at https://www.smartmontools.org
@ -64,4 +80,6 @@ Uses: `grep`, `pcregrep`, `awk`, `sed`, `tr`, `sleep`, `badblocks`
Tested with the static analysis tool at https://www.shellcheck.net to insure that the code is POSIX-compliant and free of issues.
Written by Keith Nash, March 2017. Modified by Yifan Liao and dak180.
Written by Keith Nash, March 2017.
Modified by Yifan Liao and dak180.
Updated on 20 June 2020.

View file

@ -233,7 +233,7 @@ fi
# Obtain the disk serial number:
Serial_Number="$(echo "${SMART_info}" | grep "Serial Number" | awk '{print $3}' | sed -e 's: :_:')"
Serial_Number="$(echo "${SMART_info}" | grep --ignore-case "Serial Number" | awk '{print $3}' | sed -e 's: :_:')"
# Test to see if disk is a SSD: