#!/usr/bin/env bash # This script assumes that the specified block device can be completely wiped # exit when any command fails set -e disk=$1 mp=$(mktemp -d) # f3probe the block device for counterfeit flash memory f3probe --destructive --time-ops $disk # f3write and f3read need a mounted fs mkfs.ext4 -D -F -F $disk mount $disk $mp f3write $mp sync f3read $mp umount $mp