On Fri, 2017-08-04 at 08:53 -0400, Noel Chiappa via cctalk wrote: > > But are SD cards really that unreliable?
It depends on exactly how you measure "reliable". There are a few different things going on, and it differs from one SD card to another. Firstly, there are multiple types of flash memory that can be used for the underlying storage. The flash cells can be either SLC, MLC or TLC in decreasing order of cost per bit but also in decreasing order of robustness. An SLC cell might tolerate 100,000 erase/write cycles, whereas an MLC cell might fail after only 10,000 and a TLC cell might be worn out after 3,000. The act of reading from a flash cell also disturbs the charge in nearby cells: this effect is not particularly significant for SLC, which you can generally read without restriction, but on MLC and TLC the controller needs to keep track of how many times it has read from a particular block and periodically re-write the data to refresh it otherwise it will eventually become corrupt. And finally, the charge in flash cells does eventually leak away: for MLC and TLC cards your data may disappear over a timescale of months to a few years. Consumer-grade cards will almost always use MLC flash, or possibly TLC at higher capacity levels. SLC cards are available but typically they are the "industrial grade" ones and are only available in smaller capacities. Secondly, there are many different controller ICs and the behaviour of the controller has a significant effect on how well the card works overall. Some controllers are better than others at managing bad blocks and bit errors in the flash. Some deal better than others with unexpected power failures. Some deal better than others with the "read disturb" effect. Some deal better than others with random access, particularly random writes: it's fairly common for the cheaper consumer cards to only have enough buffer space for one output file to be open at a time, and if you start trying to write multiple files in parallel to different areas of the card then the write buffer will start thrashing and performance will be dismal. It's also worth remembering that most consumer-grade cards are used in a way that is not a very close match to a disk emulator. Cameras (including cameras in phones) are generally writing a relatively small number of fairly large files. They seldom read, and they virtually never modify a file in place. Also, because all SD cards come preformatted as either FAT or exFAT, the pattern of accesses that the host will make to the filesystem is somewhat predictable and some controller ICs are specifically optimised for this. All the above said, although it probably is true that the average consumer-grade SD card is significantly less robust than the average SATA SSD that you can buy today, and probably also less robust than the average spinning hard disk, I suspect they are probably not all that much less reliable than the average 1980s or 1990s-era hard disk. Personally I would be quite happy to use an SD card to emulate mass storage in a classic computer, and in fact I was thinking just this morning about buying one of the scsi2sd boards for that very purpose. If you are going to be using it in an application that sees frequent writes then I would try to get an SLC card, or failing that a low- capacity MLC one. But otherwise, I would just make sure I had a backup and live with the possibility that the card might need replacing after a couple of years. Phil