How can I tell when a thumb drive has had too many read/write cycles?

I asked another question about building a laptop hard drive out of usb thumb drives, and one person made a good point: the read/write cylce ratings of thumb drives aren't as high as those for a regular, magnetic disk hard drive, so they would need to be replaced as they got worn out from all of the read/write cycles. So, how do I tell when a thumb drive is getting old before it keels over and I lose a chunk of my hard drive? Thanks!

orksecurity8 years ago
The simple answer is that you can't tell a memory cell is going to fail before it fails. The more complex answer would be that you design your system so it stores the data using an error-correcting code. ECC can be though of as parity bits on steroids. Parity checking will report any single-bit error, and many but not all other errors. The "standard" ECC will let you recover from any single-bit errors, and will report any two-bit error and many but not all other errors. More complicated versions can increase the correction/detection capabilities, but are more expensive in storage and computation. The simplest way to do this in a homebrew might be to implement the ECC in software, probably at the device driver level. The _right_ way to do it is arguably in hardware, but that wants to be designed in from the beginning; I don't think you want to deal with trying to retrofit it. (If you had the skills for that, you'd be working directly with EEPROMs rather than trying to use an off-the-shelf thumb drive, right?) Downside: ECC, like parity, does require additional bits be stored with every word, so you'd be giving up storage in exchange for additional robustness.