How to test a SD card
f3 is a great tool for testing if your SD card is a fake or not. It comes with two handy command-line tools: f3write and f3read. The package is just named f3 on GNU/Linux distributions, so dnf -y install f3 or apt-get install f3 to get it.
Simply mount the fat filesystem and run f3write /run/media/you/disk/ and wait hours. Unmount the filesystem and eject the card and wait 2 minutes when it's done then plug it back in. Now mount the filesystem and run f3read /run/media/you/disk/ and it will test if the files that were written are read back correctly or not.
If the card is fake then f3read's output will look something like this:
SECTORS ok/corrupted/changed/overwritten Validating file 0001.fff ... 2097152/ 0/ 0/ 0 Validating file 0002.fff ... 2097152/ 0/ 0/ 0 Validating file 0003.fff ... 2097152/ 0/ 0/ 0 Validating file 0004.fff ... 2097152/ 0/ 0/ 0 Validating file 0005.fff ... 2097152/ 0/ 0/ 0 Validating file 0006.fff ... 2097152/ 0/ 0/ 0 Validating file 0007.fff ... 2097152/ 0/ 0/ 0 Validating file 0008.fff ... 1553440/ 543712/ 0/ 0 Validating file 0009.fff ... 0/ 2097152/ 0/ 0 Validating file 0010.fff ... 0/ 2097152/ 0/ 0 (...)
In this output some of the files are OK, they are fine, but starting above 7.6 GiB all the files are corrupted. The reason for this is that this particular card is presented to the OS as a 32 GB card but in reality it's only got 8 GB of flash. Data written beyond that is discarded or re-mapped depending on how the card is faked. On some card writing beyond it's capacity will overwrite random previously written files.
If you are running Windows you can use this tool to do the same thing...