f3write
Test flash drive write speed and capacity
TLDR
Write test files to a given directory, filling the drive
Limit the write speed
SYNOPSIS
f3write [options] <device_or_mount_point>
PARAMETERS
-a, --append
Appends new files to existing ones on the target device. Use with caution to avoid unintended data modification.
-b <bytes>, --block-size=<bytes>
Sets the I/O block size in bytes. The default is 1M (1048576 bytes).
-f, --force
Forces writing, even if the device appears busy or contains data. Use this option with extreme caution, as it can lead to data loss.
-g, --full-device
Writes to the full raw device (e.g., /dev/sdb), not just a partition. The device must be unmounted for this option to work correctly.
-L, --low-memory
Optimizes f3write's operation for systems with limited memory resources.
-s <offset>, --start-offset=<offset>
Specifies the starting offset in bytes from the beginning of the device where writing should begin.
-S <offset>, --end-offset=<offset>
Specifies the ending offset in bytes, indicating where writing should stop.
-v, --verbose
Increases the verbosity of the output, providing more detailed information about the writing process.
-V, --version
Displays the version information of f3write and exits.
DESCRIPTION
f3write (Fight Flash Fraud write) is a command-line utility designed to test the actual capacity and integrity of flash storage devices, such as USB drives, SD cards, and SSDs. It achieves this by filling the target device with known data patterns.
Part of the f3 suite, f3write aims to detect counterfeit flash drives that report a larger capacity than they physically possess, often by looping the address space. By writing data to the entire usable space, it prepares the device for verification by f3read. This two-step process helps users identify if a drive is fake, has bad blocks, or is otherwise corrupted, ensuring that the advertised capacity is genuinely usable.
CAVEATS
Data Loss: f3write will overwrite existing data on the target device. It is crucial to back up any important data before running this command.
Unmounting: For accurate and safe testing, especially when using the -g option to test the full device, the target device or partition should be unmounted. Writing to a mounted filesystem can lead to data corruption or an incomplete test.
Time Consuming: Testing large capacity drives can take a significant amount of time, depending on the drive's size and write speed.
Permissions: Writing to raw devices (e.g., /dev/sdb) typically requires root privileges or appropriate user permissions.
USAGE WORKFLOW
The typical workflow for testing a flash drive involves two main steps: first, writing data with f3write, and then verifying that data with f3read. For example:
1. Write data: sudo f3write /dev/sdb1
(or sudo f3write -g /dev/sdb
for the whole device)
2. Verify data: sudo f3read /dev/sdb1
(or sudo f3read -g /dev/sdb
)
The output of f3read will indicate if any data was corrupted or if the drive has fake capacity, reporting the actual usable size.
TARGET SPECIFICATION
You can specify either a raw device (e.g., /dev/sdb) or a mounted partition (e.g., /mnt/usb). When specifying a raw device, exercise extreme caution to ensure you select the correct device, as f3write will completely overwrite it. For the most comprehensive testing, especially for detecting fake capacity, it is recommended to test the full raw device after ensuring it is unmounted.
HISTORY
The f3 (Fight Flash Fraud) utilities, including f3write, were developed by Michel Machado. The project emerged in response to the pervasive problem of counterfeit USB flash drives and SD cards that falsely report larger capacities than they physically possess. The f3 suite provides robust, open-source tools for users to reliably verify the authenticity and integrity of their flash storage devices, helping to combat this common fraud.