How do you tell a memory card is bad?

Discussion in 'Mirrorless Digital Cameras' started by randy_york, May 10, 2006.

  1. I was talking to a friend of mine about my 4gig flash card that I put
    in my D200. H stated that he only uses 1 gig and below during a
    wedding and just switches in case one goes bad you don't loose the
    whole wedding.

    This sounds like a good idea, however, his explanation of when you can
    tell a memory card is bad seamed to baffle me. He said that you can
    see black dots in you pictures, which represents bad sectors on your
    memory card.

    Has anyone ever heard of this happening? Seams to me, if a sector in
    the memory card is bad, the whole file that used the sector would be
    corrupt and unusable.

  2. It could be true. The cheap memory chip doesn't have the bit for parity checking, so the camera won't know there was an error.
  3. Randy,

    to tell if a memory card has bad blocks or not is actually more
    difficult than it looks like at first sight...

    First of all the flash-memory is not even manufactored error-free.
    (Typically 1% to 3% of the capacity is dead from beginning).
    (So, from this perspective, no flash card is error-free at all).

    Next is, that flash memory allows only a certain typical number of
    write-cycles. When a flash memory block becomes bad while writing
    it, the flash controller will assign a reserve block (from
    a location that is reserved for such blocks) and will not tell
    anything to the outside.

    You will notice an error in 2 circumstances:

    1) There is no more reserve-space available when another block
    dies while writing...since no reserve block can be assigned,
    the flash controller will have to send an error-state to the

    2) When a flash-block dies while reading, the controller cannot just
    assign a reserve block and continue ... since a reserve block wouldn't
    contain the data of the original block.

    The visability of a dead block as black pixels in a picture is
    unlikely to say the least. If a block is dead, an amount of
    x times 512 bytes cannot be read in ... that's certainly more
    than just a few pixels missing then.

    The flash-blocks do not have parity bits (to my knowledge), but
    they use block-crc's and have therefore the same ability to
    detect errors. A successfull read in of a corrupted block is
    very unlikely to happen without being detected by the flash


    PS: What I occasionally do with my 1Gig CF cards is, to fill them
    completely up with data, and format them afterwords.
    Should there have been dead block on it, they would have been
    remapped now (since there was write-access to those cells).
  4. This is my understanding...

    These cards use error detection and correction coding so they can still read and write correctly, even if some of the memory cells are bad.

    In addition to that, they spread the writes over the whole card, so one section of memory is not used all the time.

    In addition to that, they have some spare memory segments so they can remap bad segments of memory if one area stops working.

    If you get bad sectors on your card, the above scheme is failing and your card is not suitable for further use. There are various bits of software you can use like Lexar ImageRescue or the disk scanning stuff that comes with windows to check.

    Normally, however, what happens is that the filesystem written to the card has some sort of error - like when you pull the card out of the camera while it is still writing to it, or it runs out of power. In this case, there is not a hardware fault with the card, but the filesystem and files written to it may not make a lot of sense. In this case you can often recover your images using image recovery software.
  5. "What I occasionally do with my 1Gig CF cards is, to fill them completely up with data, and format them afterwords. Should there have been dead block on it, they would have been remapped now (since there was write-access to those cells)."

    Rainer-do you delete the pictures first then format the card or just format without deleting? thanks, cb
  6. @Charles,

    "do you delete the pictures first then format the card or just format without deleting?"

    Depends on what your target is.

    Normally one wants to reuse a card, after all pictures have been copied to PC (or other storage). In this case I reformat it in the camera. Since the cameras format will only overwrite the allocation
    tables this is fast, and it doesn't involve many writes.

    Deleting the pictures is more cumbersome in this regard. Each deletition means, that the corresponding directory needs to be
    rewritten and the allocation table needs to be updated. (A good
    Operatingsystem might help and keep those writes in a cache).

    So in theorie it's better to format, since less writes are involved.
    In practise (as CI P has pointed out) there is a sort of wear-
    distribution. Without this, the FATs (allocation tables) would
    the first be to become unaccessable, since writes to them are
    quite common. (And number of writes to a block is limited).

    But since there is a mechanism that cares for all blocks
    being used roughly the same number of times, I doubt that
    there is a real gain in formatting "in camera" without deleting the pictures first ... except of two things:

    1) It's very fast.

    2) The camera writes exactly the type of filesystem it understands.
    (FAT16 vs. FAT32, 1 FAT vs. 2 FAT, Clustersize, etc).

    What I usually don't do is deleting single files "in-camera" except
    in the case that I urgently need the space.
    Deleting single files will leave gaps in between the other files.
    Of corse the camera will fill those gaps, but you introduce
    fragmentation into your CF card. Not that fragmentation itself is
    something evil, but in the case your battery goes down before
    the camera finished a lengthy write access to the card, the filesystem
    is eventually left corrupted. In such a case the chance to recover
    your images is much higher if they where not fragmented.

    If I want to give a card away and want to make sure nothing is
    on it or can be recovered from it, I would fill the complete card
    with junk-data. Formatting alone, or deletition of all files
    is certainly not good enough in that case ... More than one lucky
    fellow wrote that he/she was able to recover pictures from some
    recent event, and some much older pictures turned up as well.

  7. Randy, your gut reaction to "black dots on the pictures represents bad sectors" is right. A bad block in the file will create something more like this image from
    The SanDisk spec cited above lists 1,000,000 hours MTBF. The Wikipedia article on flash memory lists 10,000 to 1,000,000 erase cycles. At one reformat a day, that's at least 30 years.
    So if you have a name brand card, don't worry.
    In the scenario where a block in an FAT or a folder info entry is corrupted, your camera will become unable to see any files on the card. But because the image files will be mostly contiguous, a tool like PhotoRescue will have a high recovery rate.
  8. That message about "undisplayable photo attachment" doesn't have anything to do with the image. Something about the way I uploaded the file must have caused it to barf.

Share This Page