Doing [a repartition and reformat] will also immediately make the real capacity apparent, too. No need for special software, just ordinary precautions will do.
I'm not sure that's the case
From the original posting:
an unscrupulous seller purchases 1 GB or 2 GB flash drives, relabels them as 8 GB or 16 GB or even 32 or 64 GB drives, and hacks the file allocation table
So they're ordinary drives, with a corrupted FAT filesystem. Easy to detect/repair before initial use.
More sophisticated corrupted *firmware* might also exist out there, but I find that rather unlikely and uneconomical for the fraudster.
Cheers