From 05aff5600fb4e7b1d396751d5e1cb8a98836848f Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sat, 4 May 2019 06:28:01 -0500 Subject: [PATCH 01/15] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd8b0ea..ecf27f2 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,10 @@ Before using the script on FreeBSD systems (including FreeNAS) you must first ex `sysctl kern.geom.debugflags=0x10` Tested under: -* FreeNAS 9.10.2-U1 (FreeBSD 10.3-STABLE) -* Ubuntu Server 16.04.2 LTS +* FreeNAS 9.10.2-U1 (FreeBSD 10.3-STABLE) +* FreeNAS 11.1-U7 (FreeBSD 11.1-STABLE) +* Ubuntu Server 16.04.2 LTS +* CentOS 7.0 Tested on these drives: * Intel DC S3700 SSD From 0749b0551484cc10e87b23e44cb80966fa2ee14b Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sun, 15 Dec 2019 13:58:55 -0600 Subject: [PATCH 02/15] Update README.md Highlight fact that script defaults to 'dry run' mode and must be changed to test drives. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ecf27f2..2cb4b56 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ 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. +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. __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.__ 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: @@ -66,4 +66,5 @@ 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. +Written by Keith Nash, March 2017. +Modified on 15 December 2019. From 4032dcc19a05ad49a8258ea64c1724fba1b6a314 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sun, 15 Dec 2019 14:06:15 -0600 Subject: [PATCH 03/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cb4b56..978d9e7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ 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'. +* Must be run as 'root', so either log on as root or use the `sudo` command (e.g., `sudo ./disk_burnin.sh daX` Performs these steps: From 14934b73d51d12b76ffa11c236ce27d7bd015bb7 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sun, 15 Dec 2019 14:11:29 -0600 Subject: [PATCH 04/15] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 978d9e7..dbd1aa6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ 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', so either log on as root or use the `sudo` command (e.g., `sudo ./disk_burnin.sh daX` +* Must be run as 'root', so either log on using the root account or use the `sudo` command (e.g., `sudo ./disk_burnin.sh sda` Performs these steps: @@ -42,6 +42,8 @@ The only required command-line argument is the device specifier, e.g.: 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. __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 reported success using `-d sat` with a Western Digital MyBook external USB enclosure. + 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: `sysctl kern.geom.debugflags=0x10` From d5ab95ba147ee82661d1c9d14df841a52ef784ee Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sun, 15 Dec 2019 14:15:14 -0600 Subject: [PATCH 05/15] Update README.md Added reference to device options based on comments by bcmryan --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbd1aa6..1b586b5 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The only required command-line argument is the device specifier, e.g.: 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. __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 reported success using `-d sat` with a Western Digital MyBook external USB enclosure. +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. 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: From 662918e898a1818bc5493fd91f7c53629fc3ec27 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sun, 15 Dec 2019 14:16:46 -0600 Subject: [PATCH 06/15] Update README.md fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b586b5..5eb728e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ 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', so either log on using the root account or use the `sudo` command (e.g., `sudo ./disk_burnin.sh sda` +* 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: From 00c5b9d9bf834c534b90c9c8e255aa39bd355617 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Tue, 7 Apr 2020 15:26:30 -0500 Subject: [PATCH 07/15] Make dry run issue more prominent --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5eb728e..224fcb6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ 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. +* 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 that line 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,7 +43,7 @@ The only required command-line argument is the device specifier, e.g.: ...will run the burn-in test on device /dev/sda -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. __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.__ +__IMPORTANT:__ 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. From 305cf1126b194b7b629baca0b9561b7b1bcf8a0b Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Tue, 7 Apr 2020 15:31:38 -0500 Subject: [PATCH 08/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 224fcb6..897952b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Performs these steps: 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 that line in the script. +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. From 70787741bd535a2fda1c6a0a74242e39febeb955 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Tue, 7 Apr 2020 15:32:04 -0500 Subject: [PATCH 09/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 897952b..b4a46b2 100644 --- a/README.md +++ b/README.md @@ -72,4 +72,4 @@ 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 on 15 December 2019. +Modified on 7 April 2020. From dd74d421ce71925ad4ace9724cf6c627132375d2 Mon Sep 17 00:00:00 2001 From: Nicolai Willems <172633+nwillems@users.noreply.github.com> Date: Thu, 9 Apr 2020 17:05:34 +0200 Subject: [PATCH 10/15] Bew more lenient when reading serial-numbers This is done to allow the log file to be generated uniqely even if the info is a bit hard to get. --- disk-burnin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk-burnin.sh b/disk-burnin.sh index a11c5ae..51b2c9e 100644 --- a/disk-burnin.sh +++ b/disk-burnin.sh @@ -157,7 +157,7 @@ if [ -z "$Disk_Model" ]; then Disk_Model=$(smartctl -i /dev/"$Drive" | grep "Model Family" | awk '{print $3, $4, $5}' | sed -e 's/^[ \t]*//;s/[ \t]*$//' | sed -e 's/ /_/') fi -Serial_Number=$(smartctl -i /dev/"$Drive" | grep "Serial Number" | awk '{print $3}' | sed -e 's/ /_/') +Serial_Number=$(smartctl -i /dev/"$Drive" | grep --ignore-case "Serial Number" | awk '{print $3}' | sed -e 's/ /_/') # Form the log and bad blocks data filenames: From 13b6f1c0119207e3d0dd149d7335b5d7122e15a9 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Wed, 29 Apr 2020 12:18:12 -0500 Subject: [PATCH 11/15] Updated applicable OS list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b4a46b2..3028a75 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Before using the script on FreeBSD systems (including FreeNAS) you must first ex Tested under: * 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 From 10541d2986dc5af0c87f4a444d916f171a33ed9e Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sat, 20 Jun 2020 23:07:10 -0500 Subject: [PATCH 12/15] Update to include info about ioctl warning on FreeBSD --- README.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3028a75..e99e893 100644 --- a/README.md +++ b/README.md @@ -43,28 +43,32 @@ The only required command-line argument is the device specifier, e.g.: ...will run the burn-in test on device /dev/sda -__IMPORTANT:__ 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.__ +__IMPORTANT: Dry Run is the default__ +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. -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: +__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) * 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 - -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) + +__DRIVE MODELS__ +The script should run successfully on any SATA disk support SMART. It has been tested on these drives: +* 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 @@ -73,4 +77,4 @@ 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 on 7 April 2020. +Modified on 20 June 2020. From c4f58e5c15fcd387ef801e8db3b6d14d9feaf817 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sat, 20 Jun 2020 23:09:11 -0500 Subject: [PATCH 13/15] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e99e893..ff0c9a1 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,13 @@ The only required command-line argument is the device specifier, e.g.: ...will run the burn-in test on device /dev/sda __IMPORTANT: Dry Run is the default__ + 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` @@ -58,6 +60,7 @@ Also note that `badblocks` may issue the following warning under FreeBSD/FreeNAS `set_o_direct: Inappropiate ioctl for device` __OPERATING SYSTEMS__ + Tested under: * FreeNAS 9.10.2-U1 (FreeBSD 10.3-STABLE) * FreeNAS 11.1-U7 (FreeBSD 11.1-STABLE) @@ -66,7 +69,8 @@ Tested under: * CentOS 7.0 __DRIVE MODELS__ -The script should run successfully on any SATA disk support SMART. It has been tested on these drives: + +The script should run successfully on any SATA disk with SMART capabilitie, which inludes just about all modern drives. It has been tested on these drives: * HGST Deskstar NAS, UltraStar, UltraStar He10, and UltraStar He12 models * Western Digital Gold, Black, and Re models From 8dfbd1f5127414e06d5e82147290ab5fa3bcca2f Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sat, 20 Jun 2020 23:11:42 -0500 Subject: [PATCH 14/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff0c9a1..063eeaf 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Tested under: __DRIVE MODELS__ -The script should run successfully on any SATA disk with SMART capabilitie, which inludes just about all modern drives. It has been tested on these drives: +The script should run successfully on any SATA disk with SMART capabilities, which inludes 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 From 87865480737c46984ba3afda8e90a79f92db2025 Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Sat, 20 Jun 2020 23:12:55 -0500 Subject: [PATCH 15/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 063eeaf..d7bcc3d 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Tested under: __DRIVE MODELS__ -The script should run successfully on any SATA disk with SMART capabilities, which inludes just about all modern drives. It has been tested on these particular devices: +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