Linux - USB flash drive memory reliability test

USB flash drives sometimes need to be tested to check that they are reliable for data storage.

Flash drives can report fake sizes and it seems they can have bad quality storage chips that breaks only after a short cycle of reads and writes.

To test this I came up with the following script. It runs f3read and f3write tools from in a loop of the repeat specified in the for-loop on the drive to ensure both that the size is correct and that it can withstand some read and write cycles.

It will use some write cycles, but it will also check the reliability.

apt install f3

Put the script in a like

for value in {1..15}
  NOW=$(date +"%Y-%m-%d %H:%M:%S")
  echo "$NOW Test $value start"
  f3write --show-progress=1 $1
  f3read $1
  NOW=$(date +"%Y-%m-%d %H:%M:%S")
  echo "$NOW Test $value end"

Make it executable:
chmod +x

Mount the flash drive somewhere or open it from the desktop and check where it is mounted with df

The do this, and make sure to put the correct path to the flash drive since f3 uses it:
./ /path/to/the/flashdrive/

Check the results - the size, the write and read speeds and that the data is validated as it should.

Test in different ways too

Do not rely only on this test, also try to put some files on the drive, unplug and plug it in and check if the files are intact.

This is a personal note. Last updated: 2021-01-13 23:54:21.







Don't forget to pay my friend a visit too. Joakim