How do I reformat a USB stick containing read-only files?

What do you mean? After formatting?

Try:
WARNING: the -f option allows usage on a mounted drive, so be absolutely sure you select the correct drive.
You can remove the f option, if you manage to dismount the target drive.

sudo badblocks -svf /dev/sdd -o badblocks1.log

You also may add the w option, since you don’t care to keep the files on the drive. Adding the w option usually overwrites all files on the target drive.

1 Like