This advice should go without saying:

"Re-format the random SD cards you get from Amazon specifically on the device you're gonna use them."

Do this also for portable hard drives.

Since it comes up so often now, reformat the drive and then do what to verify that it's a legit drive, and not one that advertises as being larger than it actually is?

Put a bunch of large media files on it and verify that they still play properly?

I always use this tool https://github.com/AltraMayor/f3

It fills the entire device with data and then tries to read it all back. It can tell you how many bytes were successfully read, how many were corrupted and how many were written over by other writes.

Even on cards I know are real I still run the test because I have had a card that had a few bytes that got corrupted which caused loads of issues with my rpi.