I have a couple hundred of "fake" flash drives; The kind you would see on online store, with false/questioning sizes, like "1TB" or "1ZB"...
How do i know they are "fake"? They basically stop the transfer of files after some point, where they basically fail and the OS where the transfer happen usually show an error.
Now i did manage to check for the real size of such flash drive, and set them to their real size, a while ago (couple years ago, so i don't remember the exact procedure), but i did so:
- Fill flash drive until error come up, and note down/print the actual/exact size of said data when the error comes up (since it would indicate the real size of said flash drive).
- "format" the flash drive to it's real size, by using
dd
.
I'm already partially aware on how to do the first part. The problem comes at the second part, which I'm not entirely sure how it is done, though i do remember that back then, when i did it, i used dd
to write an empty image file i created, of the exact, real size of the flash drive, and used dd
with it.
Some might think/argue that, "it is useless" or "the effort outweigh the result", which might be true if i only had one or two of these, but given that i always can find a use for these flash drives, even if not practical (due to the amount), it doesn't mean it's useless.
It is also possible given i managed to do it once, though i forgot about it...(and others probably managed to do something similar, though i didn't find any such examples on linux)
I don't have any data on these, and i also do not care if they break (given the amount i have) but i would still prefer setting them to their real size, as previously stated.
I basically want to do all of this with bash
, dd
, and some other Posix utilities.
fdisk
? Becausedd
to change the partition table is not going to be easy...