disk-test

Releases, manual page

Block device read-write test utility written in bash

Usage

disk-test
  [-a|--actions actions]
  [-b|--block-size blockSize]
  [-c|--count-bytes numberOfBytes]
  [-s|--skip-bytes numberOfBytes]
  [--]
  deviceOrFile

disk-test [--help]

Tests if a device can write and correctly read arbitrary data over its entire reported size, or over a specified range.

Actions

In particular, performs an arbitrary sequence of actions on the device or on a range thereof. The desired sequence is given as a string of characters. Available actions are:

Terminates with exit code 2 if the data being read is not identical to the data that has been written before (in case of "v"), or if a device-related error occurs.

The pseudo-random data varies for each "w" action and is generated by encrypting a stream of zeros with 256-bit AES in CTR mode, which should be reasonably fast and usually outperforms /dev/urandom.

Use cases

The primary use case is to assess data storage mediums' correct operation with the goal of preventing data loss. To give some examples, the utility may be used to

Apart from preventing data loss, identifying faulty devices well ahead of a warranty's or defects liability's deadline may avoid unnecessary expenses.

Used data storage mediums should be wiped before they are sold; using disk-test on them is one way to achieve this within reasonable time while on the same occasion indicating damaged mediums that should not be put up for sale.

The utility may also be used to estimate devices' bulk read and particularly write speeds of incompressible data, notably of mediums that traditionally struggle with data writing throughput such as USB thumb drives, SD cards and low-capacity solid state disks.

Examples

(The examples are from previous version 0.1.1, invocation and output differ for the current version.)

This is what it looks like when disk-test is applied, with 1 pseudo-random pass, to a cheap but fully functional 4 GB USB 2.0 thumb drive:

[user@system ~]$ sudo disk-test 1 /dev/sdb
Password:
 INFO  Pseudo-random pass 1 of 1: "/dev/sdb"
 INFO  Writing pseudo-random: 3,75GiB 0:09:21 [6,84MiB/s] [==================>] 100%
 INFO  Reading and comparing: 3,75GiB 0:02:33 [24,9MiB/s] [==================>] 100%
 INFO  Final pass with zeros: "/dev/sdb"
 INFO  Writing zeros: 3,75GiB 0:09:18 [6,87MiB/s] [==========================>] 100%
 INFO  Reading and comparing: 3,75GiB 0:02:40 [23,9MiB/s] [==================>] 100%
 INFO  Finished, no errors: "/dev/sdb"
[user@system ~]$

Here a newly purchased 2.5" 2 TB USB 3.0 portable HDD was tested with 2 pseudo-random passes, and was found to work as expected:

[user@system ~]$ sudo disk-test 2 /dev/sdb
Password:
 INFO  Pseudo-random pass 1 of 2: "/dev/sdb"
 INFO  Writing pseudo-random: 1.82TiB 5:32:21 [95.7MiB/s] [==================>] 100%
 INFO  Reading and comparing: 1.82TiB 5:21:02 [99.0MiB/s] [==================>] 100%
 INFO  Pseudo-random pass 2 of 2: "/dev/sdb"
 INFO  Writing pseudo-random: 1.82TiB 5:32:21 [95.7MiB/s] [==================>] 100%
 INFO  Reading and comparing: 1.82TiB 5:20:59 [99.1MiB/s] [==================>] 100%
 INFO  Final pass with zeros: "/dev/sdb"
 INFO  Writing zeros: 1.82TiB 5:32:26 [95.6MiB/s] [==========================>] 100%
 INFO  Reading and comparing: 1.82TiB 5:21:01 [99.0MiB/s] [==================>] 100%
 INFO  Finished, no errors: "/dev/sdb"
[user@system ~]$

Usage recommendations for SMART-capable devices

When testing devices that support SMART error reporting, as do virtually all SATA devices and many USB-connected HDDs and SSDs, it is a good idea to retrieve and store a SMART error report before testing. After testing it can be compared against a new SMART report to see whether certain telltale attribute values have deteriorated.

If the RAW_VALUE of these attributes has increased the device's reliability might be compromised (this list is incomplete):

SMART reports can be retrieved with the "smartctl -a <device>" command; smartctl is part of smartmontools.

SMART-capable devices usually support running self-tests, typically a superficial one ("short") and a complete scan ("long"). HDDs often also offer a "conveyance" test.

It is a good idea to run the complete/long SMART self-test on the device in addition to disk-test. A device can be told to run this self-test with the command "smartctl -t long <device>"
This self-test is faster than disk-test but still takes some time; as a ballpark figure for HDDs assume about 1 hour per TB.

After completion the test results will be shown in the SMART report in the respective section.

Also, before and after the complete/long self-test look out for these SMART attributes; they are typically only updated during such a self-test. If their RAW_VALUE has increased the device might have reliability problems (list also incomplete):

License

GNU General Public License version 3

Packages

Browseable sources

These source files of the latest tag can be viewed in the browser:

Releases

disk-test-0.2.2

26 September 2019 (2019-09-26 20:16:50 UTC)

disk-test-0.2.2.tar.gz SHA256 checksum SHA384 checksum PGP signature

disk-test-0.2.1

25 September 2019 (2019-09-25 18:19:40 UTC)

disk-test-0.2.1.tar.gz SHA256 checksum SHA384 checksum PGP signature

disk-test-0.2.0

24 September 2019 (2019-09-24 16:53:18 UTC)

disk-test-0.2.0.tar.gz SHA256 checksum SHA384 checksum PGP signature

disk-test-0.1.1

01 October 2018 (2018-10-01 21:10:44 UTC)

disk-test-0.1.1.tar.gz SHA256 checksum SHA384 checksum PGP signature

disk-test-0.1.0

30 April 2018 (2018-04-30 22:10:28 UTC)

disk-test-0.1.0.tar.gz SHA256 checksum SHA384 checksum PGP signature