System Administration

Essential System Tools: f3 – detect and fix counterfeit flash storage

Last Updated on May 28, 2022

In operation

f3 provides 5 command-line utilities. Let’s look at them each in turn.

f3write

f3write fills a drive with 1GB .h2w files to test its real capacity.

The tool has a flag (-w) which lets you set the maximum write rate. You can show the progress made with the -p flag.

Here’s an image of f3write in action, writing to a piece of flash media with an abysmal write speed. That’s the fault of the flash media, not f3write.

f3write-in-progress

f3read

After you’ve written the .h2w files to the flash media, you then need to check the flash disk contains exactly the written files. f3read performs that checking function.

f3read

Unlike f3write, f3read doesn’t offer the current read speed, although the average reading speed is reported once the process is complete.

Everything checks out; all the N.h2w files are valid. The flash media tested here is cheap and cheerful which explains the slow write/read speeds. But at least it’s legit!

f3probe

The process of f3write and f3read can be time consuming, particularly if you are testing high capacity slow writing media. There’s an alternative. It’s called f3probe.

f3probe works differently to f3write/f3read in many ways. It works directly over the block device that controls the drive. So the tool needs to be run with elevated privileges. It only writes enough data to test the drive. You’ll need to know the block device of the drive. And f3probe destroys any data on the tested drive. Make sure you’ve made a backup of the drive first if it contains important data.

When a drive is fake, f3probe writes the size of the cache of the drive a couple times, and a small number of blocks.

f3fix

Obviously if your flash drive doesn’t have the claimed specifications, there’s no way of ‘fixing’ that. But you can at least have the flash correctly report its capacity to df and other tools.

f3fix creates a partition that fits the actual size of the fake drive. It’s quick to complete.

f3brew

f3brew is designed to help developers determine how fake drives work.

Next page: Page 3 – Other Features

Pages in this article:
Page 1 – Introduction / Installation
Page 2 – In Operation
Page 3 – f3-qt – GUI frontend to f3
Page 4 – Summary