What causes an SD card to go corrupt?

  • One of my cheap SD cards goes corrupt from time to time and the camera demands it needs to be reformatted.

    It's frustrating, but I want to know what might be the reason that makes it go corrupt and why this might be linked to cost. It can hold close to the advertised capacity of 16gb for months sometimes and other times it gets corrupt after a couple of snaps.

    best thing is to use pro line compactflash. If thats not possible, then go for pro line SD cards, like sandisk extreme. you said it yourself "One of my cheap SD cards ". you get what you pay for. cheap usb drives and sd cards cant be expected to last you more than 1-2 times.

  • mattdm

    mattdm Correct answer

    8 years ago

    There are several ways in which an SD card can go bad.

    Physical Damage

    First, cards can be actually physically broken. You can bend them in half pretty easily if you try, but in general they're actually pretty resilient. Many are effectively water-proof even if not marketed that way. I've sent cards through the laundry, and once I dropped one full of precious baby photos right into hot coffee — no problem! Now, I wouldn't recommend pushing your luck, but if you're careful, this is unlikely.

    Electrostatic discharge could also damage the electronics, although again most cards are surprisingly well-resistant. (Try to intentionally destroy a card with static and your success rate will be low.)

    Flash isn't particularly light-sensitive, so airport x-rays aren't a real risk (longer exposure to high-energy x-rays is another story). And magnets aren't a worry either — "A magnet powerful enough to disturb the electrons in flash would be powerful enough to suck the iron out of your blood cells", according to the executive director of the Compact Flash Association.

    It's also surprisingly heat-resistant — the plastic housing is probably at more risk than the memory itself.

    Filesystem and File Corruption

    Physical damage is at the most basic level. At the higher end, you can have corruption and data loss without anything fundamentally going wrong. The firmware in cameras and card readers (that is, the mini-os and software that runs on the device) can make mistakes, or be caught in situations it can't handle.

    The most obvious is that you can mess things up if you pull out the card while trying to write to it. Don't do that. (And remember that with caching, that can happen quite a while after you think the data transfer is done.) With SD or Compact Flash cards, it's usually reasonably safe to remove the card from a reader while it's mounted for read access; beware that if you happen to have an xD card device that this is not safe.

    A bug could happen in deleting files, or if the card fills up. And, it's theoretically possible that if you format the card on a computer conflicting filesystem bugs will cause issues.

    Presuming you avoid the yank-the-card-out scenario, and don't have a hardware failure, these are also pretty rare, because the filesystem implementations used in cameras have been around for a long time and are very well tested.

    It's also possible that bad cables, bad USB ports, or problems in the computer itself could corrupt files on transfer. Trying again on another system is always a good first diagnostic.

    In all of these cases, the card itself is really fine — reformat and you can use it again.

    Bad Blocks

    Then, there's the SD card really going corrupt.

    This happens in two major ways:

    Manufacturing Defects

    There's a lot of pressure to produce small, cheap, high-capacity devices. In order to do this, manufacturers have learned to not worry about perfection, and ship devices with something like 2-5% of the memory already bad, right out of the factory. These initial bad blocks are masked out and shouldn't affect anything, but actually do have a long term effect — see below.

    And it's possible that a particular card will have a lot more than it's supposed to, including blocks which weren't properly masked out. This is much more likely with cheap cards.

    Accumulated Failure

    Flash memory inherently has a limited number of write/erase cycles. Inevitably, electrons get trapped where they're not wanted, and the voltage levels shift, eventually causing read or write failure. Any given bit of flash memory is specified for a certain number of cycles before failure, but really it's a random process and there could be a problem long before the numbers would predict on average.

    Coping Mechanisms

    Because these things are inevitable, SD cards are designed to minimize the damage. In addition to the masking out of bad blocks initially, they detect and mask out new bad blocks as they appear. They're made with excess capacity initially, and as blocks wear out, spare blocks are transparently substituted, so everything keeps working. The flash card's built-in controller will use error correction to prevent the errors from corrupting data as they occur.

    But, cheaper cards may have less sophisticated error correction, and are likely to have less spare capacity for covering up for bad blocks.

    Flash devices also use wear leveling, so that writes are spread across the whole device, not just always using the same area over and over. Here again, cheap cards may do a worse job of this.

    So, Overall...

    It's worth it to buy high-quality name-brand cards because of the inherent issues in the last section. Even then, failure is inevitable (like death and taxes), so don't place all of your eggs in the same basket — make sure you have backups. Other than that, the main advice is to be careful when writes are occurring.

    Name brand is the way to go, but beware of counterfeit cards. It's often difficult to tell if you really got a SanDisk, Lexar, etc card. Search for 'sd card counterfeit' - it's not a short list :( This is definitely a case of 'you get what you pay for'.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM