How to fill a flash drive with 1s instead of zeros
I recently ran the F3Tools on a large USB thumb drive that I purchased. It has a 240 GB FAT32 filesystem (not exFAT or NTFS, actual FAT32) on it, and it's supposed to be 256 GB, so I got slightly suspicious. Turns out it's legit, but now I have a flash drive with random data written to all of its sectors, which is bad for write amplification and speed issues down the road.
Since flash drives erase to 0xFF rather than 0x00, is there a way to overwrite a device or file with 1s rather than zeros? If I use zeros, there'll be the same write amplification issue.
I am using Linux (Ubuntu 18.04), so system tools would be best, but I'll also accept anything that's in the apt-get package store.
Run this in a terminal:
cat /dev/zero |tr '\0' '\377' |dd of=/dev/sdx
Notes:
- Replace
sdx
with your device name, after being absolutely certain it's the right one. (I like to usegparted
to review at all my devices, sizes, etc.) - The
tr
command changes 0x00 (all zeros) to 0xFF (all ones). - When this finishes, it will give an error that the drive is full. This is expected.
- You are probably aware - flash drives have a limited number of write cycles.