disktest 1.0.0

Hard Disk and Solid State Disk tester
<div id="disktest-hard-disk-hdd-solid-state-disk-ssd-usb-stick-memory-card-e-g-sd-card-tester">
<h2>disktest - Hard Disk (HDD), Solid State Disk (SSD), USB Stick, Memory Card (e.g. SD-Card) tester</h2>
<p><a href="https://bues.ch/h/disktest" rel="nofollow">https://bues.ch/h/disktest</a></p>
<p>Disktest is a tool to check Hard Disks, Solid State Disks, USB sticks, SD cards or similar storage media for errors.</p>
<p>It does so by writing a pseudo random sequence to the device and then reading it back and verifying it to the expected pseudo random sequence.</p>
<p>This tool can be used to:</p>
<ul>
<li>Check disks for hardware errors (e.g. platter errors, Flash errors, etc…).</li>
<li>Overwrite storage media with a cryptographically strong pseudo random stream. This can either be used to delete existing data on the disk, or to prepare the disk for encryption.</li>
<li>Test for tampered media that pretend to have more storage area than they physically actually have. Sometimes such media are sold by fraudulent sellers for cheap prices.</li>
<li>… probably lots of other tasks.</li>
</ul>
<p>The random number stream is a concatenation of hashes generated by the following algorithm:</p>
<pre>S = PBKDF2(SEED | THREAD_ID)
HASH_DATA = SHA512(S | PREVIOUS_HASH_DATA | MONOTONIC_INC_COUNTER)
</pre>
<p>If more than one thread is used, then each thread generates such a hash stream, which are then interleaved in a regular
pattern.</p>
<p>The algorithm can also be switched to a CRC based algorithm, that is much faster, but <em>not</em> cryptographically secure. However CRC is sufficient to find physical disk errors. Disktest defaults to the secure SHA512 based algorithm.</p>
</div>
<div id="dependencies">
<h2>Dependencies</h2>
<ul>
<li><a href="https://www.rust-lang.org/" rel="nofollow">Rust (edition 2018)</a> or later.</li>
<li>Crate dependencies will automatically be downloaded by cargo.</li>
</ul>
</div>
<div id="running-without-installing">
<h2>Running without installing</h2>
<p>Build and run disktest in place without installing it:</p>
<pre>cargo run --release --  DISKTEST_OPTIONS_HERE
</pre>
<p>See below for a description of the available <cite>disktest</cite> options.</p>
</div>
<div id="installing">
<h2>Installing</h2>
<p>Build disktest and install it to <cite>$HOME/.cargo/bin</cite>:</p>
<pre>cargo install --path .
</pre>
</div>
<div id="disktest-command-line-options">
<h2>Disktest command line options</h2>
<p>Please run either of the following commands to show more information about the available command line options.</p>
<pre>cargo run --release -- --help
cargo run --release -- -h
disktest --help
disktest -h
</pre>
</div>
<div id="speed">
<h2>Speed</h2>
<p>The following table shows some example speed measurements of disktest in various operation mode on different hardware.</p>
<p>These speed tests don’t write to an actual disk, but only to the <cite>/dev/null</cite> device, which is a device that does nothing. So these speed test results do not include the speed limits of any actual disk hardware.</p>
<table>
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<thead>
<tr><th>Command</th>
<th>Algorithm</th>
<th>Hardware</th>
<th>Data rate written</th>
</tr>
</thead>
<tbody>
<tr><td>disktest -j6 -w /dev/null</td>
<td>SHA512</td>
<td>AMD Phenom II X6 1090T; 6 cores 3.2 GHz</td>
<td>675 MiB/s</td>
</tr>
<tr><td>disktest -j6 -ACRC -w /dev/null</td>
<td>CRC</td>
<td>AMD Phenom II X6 1090T; 6 cores 3.2 GHz</td>
<td>4.6 GiB/s</td>
</tr>
<tr><td>disktest -j4 -w /dev/null</td>
<td>SHA512</td>
<td>Intel i5-3320M; 2+2 cores 2.6 GHz</td>
<td>250 MiB/s</td>
</tr>
<tr><td>disktest -j4 -ACRC -w /dev/null</td>
<td>CRC</td>
<td>Intel i5-3320M; 2+2 cores 2.6 GHz</td>
<td>3.4 GiB/s</td>
</tr>
<tr><td>disktest -j4 -w /dev/null</td>
<td>SHA512</td>
<td>Raspberry Pi 4; 4 cores 1.5 GHz</td>
<td>75 MiB/s</td>
</tr>
<tr><td>disktest -j4 -ACRC -w /dev/null</td>
<td>CRC</td>
<td>Raspberry Pi 4; 4 cores 1.5 GHz</td>
<td>605 MiB/s</td>
</tr>
</tbody>
</table>
<p>The read data rates are similar, because the algorithm used is exactly the same.</p>
<p>Note: The default rust compiler shipped with Raspberry Pi OS is too old to compile Disktest. A newer Rust compiler must be used on Raspberry Pi.</p>
</div>
<div id="license">
<h2>License</h2>
<p>Copyright (c) 2020 Michael Buesch &lt;<a href="mailto:m&#37;&#52;&#48;bues&#46;ch">m<span>&#64;</span>bues<span>&#46;</span>ch</a>&gt;</p>
<p>Licensed under the terms of the GNU General Public License version 2, or (at your option) any later version.</p>
</div>