A small Linux toolkit to diagnose, stress-test, and reformat USB storage (SD/microSD cards via a USB adapter, and USB flash drives) for maximum device compatibility — e.g. rescuing a card that some devices call "corrupted".
format.sh— main one-shot (destructive): auto-detect the target device → diagnose → counterfeit-check (f3probe) → reformat (capacity-adaptive FAT16 for ≤ 2 GB, FAT32 for larger) → full verify → clean & empty.check.sh— read-only health check (identity, geometry, BPB,fsck -n, kernel log). Touches nothing.format-variants.sh— fallback layouts for a finicky device that rejects the standard format (FAT16/FAT32, ± active flag, or superfloppy/no-MBR).
./format.sh # auto-detect device, thorough
./format.sh full # + 4-pattern badblocks surface scan (slow)
./format.sh quick /dev/sdb # skip full-capacity test, explicit device
./check.sh # read-only, no changes
Every destructive step is gated: the target must be **USB + removable + ≤ 16 GiB
- not the root disk**;
f3probehalts before reformat if capacity is counterfeit; an 8-second countdown lets you abort after the target is shown. Scripts are self-locating (logs are written next to the script).
bash, sudo, f3 (Fight Flash Fraud), dosfstools, util-linux, e2fsprogs, udisks2.
See CLAUDE.md for the full design notes and the original forensic case (REPORT.md).