panthema / 2013 / disk-filltest
Thumbnail of a pie chart filling to 100%

disk-filltest - Simple Tool to Detect Bad Disks by Filling with Random Data

TalkBox
Gravatar Adam Piggott:

I'm switching my main computers from Windows to Linux and updating my software toolboxes. disk-filltest looks ideal for verifying flash and SSD media. Thank you!

Gravatar xrosolar:

I did something similar but I use the same 30 GB data set with known md5s. I repeatedly go through the files and check the sums. You would be surprised (or not) but after 24h of this some drives start giving wrong sums. And this is on systems that have been put through extensive burn-ins with prime95 and memtest and more. For example I have this one 500gb drive from WD blue that after a while throws bad sums on this test. Amazing stuff, I have kept the drive for science, and not rma'ed it. Cool site btw. VERY COOL!




Posted on 2013-03-27, last updated 2020-06-26 by Timo Bingmann at Permlink.

The number of hard disk produced in the last five years is huge. Of course, this is the same number of hard disks that will most probably fail in the next five years, possibly with catastrophic consequences for the particular user or business.

The simple tool disk-filltest can help, together with S.M.A.R.T. monitoring, to check disks periodically and thus be forewarned about coming failures. The function of disk-filltest is simple:

The method is simple and effective, however, it of course does not verify other files on the disk. That is a different task, which can be solved efficiently using digup (a Digest Updating Tool).

Another useful side-function of disk-filltest is to measure read/write speed while filling the disk. Slow speeds may also indicate a future failure, or just bad disk controlling.

The program runs on Linux, Windows and probably any other POSIX-compatible system. The whole source code is just one .c-file.

Downloads

disk-filltest 0.8.2 (current) released 2020-06-26
Source code archive: disk-filltest-0.8.2.tar.gz disk-filltest-0.8.2.tar.gz (17.2 KiB) Browse online
Generic x86 Linux binaries: disk-filltest-0.8.2-linux.tar.gz disk-filltest-0.8.2-linux.tar.gz (11.6 KiB)
Win32/MinGW binary: disk-filltest-0.8.2-win32.zip disk-filltest-0.8.2-win32.zip (11.3 KiB)

The source code is published under the GNU General Public License v3 (GPL), which can be found in the file COPYING.

A git repository containing all sources and revisions is fetchable by running
git clone https://github.com/bingmann/disk-filltest.git

Short Usage Guide

Just call disk-filltest on the command line, optionally adding -u. The tool will fill the current directory with random data files. About 575 GiB were free in the example directory, as seen from the run below:

tb@deka ~/datahdd $ disk-filltest -u
Writing files random-######## with seed 1364065156
Wrote 1024 MiB random data to random-00000000 with 279.864766 MiB/s
Wrote 1024 MiB random data to random-00000001 with 107.078272 MiB/s
Wrote 1024 MiB random data to random-00000002 with 108.964478 MiB/s
Wrote 1024 MiB random data to random-00000003 with 115.551387 MiB/s
Wrote 1024 MiB random data to random-00000004 with 103.198904 MiB/s
Wrote 1024 MiB random data to random-00000005 with 107.402722 MiB/s
Wrote 1024 MiB random data to random-00000006 with 138.360599 MiB/s
Wrote 1024 MiB random data to random-00000007 with 113.862503 MiB/s
[...]
Wrote 1024 MiB random data to random-00000571 with 44.394972 MiB/s
Wrote 1024 MiB random data to random-00000572 with 32.891062 MiB/s
Wrote 1024 MiB random data to random-00000573 with 43.505017 MiB/s
Wrote 1024 MiB random data to random-00000574 with 10.343835 MiB/s
Error writing next file random-00000575: No space left on device
Wrote 138 MiB random data to random-00000575 with 28.315684 MiB/s
Verifying files random-######## with seed 1364065156
Read 1024 MiB random data from random-00000000 with 56.286455 MiB/s
Read 1024 MiB random data from random-00000001 with 23.081034 MiB/s
Read 1024 MiB random data from random-00000002 with 69.574330 MiB/s
Read 1024 MiB random data from random-00000003 with 105.285789 MiB/s
[...]
Read 1024 MiB random data from random-00000571 with 32.974293 MiB/s
Read 1024 MiB random data from random-00000572 with 29.421141 MiB/s
Read 1024 MiB random data from random-00000573 with 26.699826 MiB/s
Read 1024 MiB random data from random-00000574 with 14.714866 MiB/s
Error reading file random-00000575: No space left on device
Read 138 MiB random data from random-00000575 with 12.073844 MiB/s
Removing old files ...... [...] ..... total: 576.
tb@deka ~/datahdd $

Command Line Help

The tool has some pretty versatile command line functions, which are targeted for batched and automated runs.

tb@deka ~/datahdd $ disk-filltest -h
Usage: ./disk-filltest [-s seed] [-f files] [-S size] [-r] [-u] [-U] [-C dir]

disk-filltest 0.8.2 is a simple program which fills a path with random
data and then rereads the files to check that the random sequence was
correctly stored.

Options: 
  -C <dir>          Change into given directory before starting work.
  -f <file number>  Only write this number of 1 GiB sized files.
  -N                Skip verification, e.g. for just wiping a disk.
  -r                Only verify existing data files with given random seed.
  -R <times>        Repeat fill/test/wipe steps given number of times.
  -s <random seed>  Use random seed to write or verify data files.
  -S <size>         Size of each random file in MiB (default: 1024).
  -u                Remove files after successful test.
  -U                Immediately remove files, write and verify via file handles.
  -V                Print version and exit.
  

The only option requiring more explanation is -U. In this mode, the tool will create the files random-######## as usual, but will immediately unlink() them from the file system (the directory stays empty). On Linux this is possible, because the tool can keep the file descriptors open and perform the usual write/read/verify sequence. The mode is very useful for batch checking, because the system will automatically free the used disk space when the program finishes, whether successfully or with an error!

ChangeLog

2020-06-26 - Timo Bingmann - v0.8.2

2020-01-20 - Timo Bingmann - v0.8.1

2020-01-17 - Timo Bingmann - v0.8

2013-05-07 - Timo Bingmann - v0.7.1

Older Downloads

disk-filltest 0.8.1 released 2020-01-20
Source code archive: disk-filltest-0.8.1.tar.gz disk-filltest-0.8.1.tar.gz (17.1 KiB) Browse online
Generic x86 Linux binaries: disk-filltest-0.8.1-linux.tar.gz disk-filltest-0.8.1-linux.tar.gz (11.1 KiB)
Win32/MinGW binary: disk-filltest-0.8.1-win32.zip disk-filltest-0.8.1-win32.zip (11.1 KiB)

disk-filltest 0.8 released 2020-01-17
Source code archive: disk-filltest-0.8.tar.gz disk-filltest-0.8.tar.gz (16.8 KiB) Browse online
Generic x86 Linux binaries: disk-filltest-0.8-linux.tar.gz disk-filltest-0.8-linux.tar.gz (10.8 KiB)
Win32/MinGW binary: disk-filltest-0.8-win32.zip disk-filltest-0.8-win32.zip (11.0 KiB)

disk-filltest 0.7.1 released 2013-05-07
Source code archive: disk-filltest-0.7.1.tar.bz2 disk-filltest-0.7.1.tar.bz2 (14.1 KiB) Browse online
Generic Linux binaries: disk-filltest-0.7.1-linux.tar.bz2 disk-filltest-0.7.1-linux.tar.bz2 (8.85 KiB)
Win32/MinGW binary: disk-filltest-0.7.1-win32.zip disk-filltest-0.7.1-win32.zip (19.5 KiB)

disk-filltest 0.7 released 2013-03-27
Source code archive: disk-filltest-0.7.tar.bz2 disk-filltest-0.7.tar.bz2 (14.1 KiB) Browse online
Generic Linux binaries: disk-filltest-0.7-linux.tar.bz2 disk-filltest-0.7-linux.tar.bz2 (8.85 KiB)
Win32/MinGW binary: disk-filltest-0.7-win32.zip disk-filltest-0.7-win32.zip (19.3 KiB)