I hate computers

Do Compact Flash cards go bad? I keep being unable to get my pictures off my camera (Nikon CoolPix 990.) This only started happening recently... Normally I just stick the card into my USB CF reader (SanDisk ImageMate SDDR-31) and mount it as a VFAT. But every now and then, Linux can't mount it:

     mount: No medium found
     kernel: sdb : READ CAPACITY failed.
     kernel: sdb : status = 0, message = 00, host = 7, driver = 00 
     kernel: sdb : sense not available. 
     kernel: sdb : block size assumed to be 512 bytes, disk size 1GB.  
     kernel:  sdb: I/O error: dev 08:10, sector 0
     kernel:  unable to read partition table

This might only happen when the camera's batteries have run out since last time, suggesting that the camera is corrupting the card in some way. But, this has only started happening within the last couple of months, and I've had the camera for almost two years.

The camera can still display the pictures, though, so it's not corrupted so badly that the camera can't read it. Reformatting the card (with the camera) fixes things, but wipes out the pictures, of course.

The last time this happened, I was able to get the pix off using GPhoto2, using the camera's USB interface instead of accessing the CF card directly, but it was a huge pain in the ass. After about a dozen tries, I was able to get it to work once on my home machine, but I was never able to get it to work on my office machine (where I really need it.) Gphoto is just horrid.

So either the card is going bad, the camera itself is broken, or some recent Linux kernel upgrade has gotten more picky about who-knows-what than it was before.

Oh, it just started working again: apparently all I have to do is try and mount the thing over and over, a dozen times in a row until it finally takes.

I hate computers.

Tags: , ,

18 Responses:

  1. eaterofhands says:

    Yes, afaik all flash media goes bad after a while. I forget how many writes the average CF card is rated for but I could imagine that after two years of heavy picture taking you might start reaching the failure point. I think its around a few hundred thousand writes per sector. I've got a smartmedia card in an ancient camera that is starting to loose pictures after 4 years. I'm assuming (hoping) its media failure.

  2. ralesk says:

    "I hate computers."

       Hearing this from your mouth Reading this from your fingers is pretty surprising.
       Should I be cruel and suggest trying the little bastard CF or the camera's USB on a non-Linux machine next time? ^^;

    • jwz says:

      Should I be cruel and suggest trying the little bastard CF or the camera's USB on a non-Linux machine next time?

      The last time this happened, we tried to get the pix off via <lj user=rzr_grl>'s OSX machine, and it still didn't work, except instead of giving me arcane error messages, it just sat there with a contentless dialog box up indefinitely. Because that's "friendlier."

      • ralesk says:

           Haha, last time I saw a contentless error dialog was Win32/Netscape 4.x, but it was more frequently on Win 3.1/NS3.2x at school :]

  3. icis_machine says:

    i asked around work since we need our products to work with CF and they said it was rare. you should focus on the word flash. flash doesn't just go bad until a bajillion writes are done... something has gotta be in the middle of writing and stopping.

    it could be the batteries aren't sustaining enough power to get the timing on a poorly written flash library function.

    can you do a dump of the flash area and see if you have precise blocks of 0xff's?

    • jwz says:

      can you do a dump of the flash area and see if you have precise blocks of 0xff's?

      I don't have the slighest idea how to do that. I'm just a caveman.

      • icis_machine says:

        i don't know really when it comes to soem of these readers and dealing with like OS's.

        i know there are simple interfaces (i.e. doesn't appear to be chips on it, just direct formfactor change) to access CFs as an IDE drive... and i know you gotta be able to do a sector dump of a disk.

        there's gotta be some info somewhere.

        • jwz says:

          I dunno, "od -x /dev/sdb" does show some FFFF blocks, but they're not very big, and it's not obvious that they aren't supposed to be there. There aren't many repeating patterns, which isn't surprising, since this is mostly leftover jpeg data.

          Mounting it is still fickle: sometimes it works, sometimes not. I guess I'll reformat it again.

          • jwz says:

            When the card is in the unreadable state, "od < /dev/sdb" fails with the same READ CAPACITY error as "mount".

      • chaobell says:

        In that case, I would suggest finding two large rocks and smashing the card between them.

        It won't fix your problem, but it might make you feel better.

    • q says:

      It'll only do bajillions of writes if it's never static-shocked, and isn't in the presense of strong magnetic fields. Static shock can damage the buried gate near the tunnelling divot (I can't remember the name), and though you can re-write, that doesn't undo the damage to the oxide layer. The result will be difficulty on writing 0's I believe.

      • icis_machine says:

        i think that goes for any flash device. of course i don't generally deal with parts that people move around and touch.

        i'm probably assume a lot given that it's using the world flash.
        this is why i'm asking if he's getting blocks of 0xff since in order to write to regular flash one must erase a sector (set everything to 0xff) before writing data. this now seem a bit more valid given your last statement.

        however the same logic could be applied if you think of it as a hdd. sure it might help if you reformat but if it still screws up, time for a new one. at least to see if it's the the CF or the camera.

  4. brad says:

    Been there.

    It can be worse, though: this morning Linux BUG()ed on me mounting my RAID. Rebooted, and it worked.

    I love/hate Linux.

  5. ch says:

    The usb-storage driver is flaky. It generally works OK with the SDDR-31 in my experience, but sometimes it wanks out. What kernel are you running? (You shouldn't need to know, but ... this is technology, man.)

    You might consider getting a CF <-> IDE adapter so you can get USB (and usb-storage) out of the loop. These are pretty cheap and you can get them in a form factor that mounts in an empty drive bay.

    Flash (and hence CF) definitely goes bad -- you can write a given block just so many times. Clever flash-aware filesystems (e.g. jffs2) do wear leveling to extend life. FAT on CF is not clever.

    • jwz says:

      kernel 2.4.9-13smp on one machine, 2.2.16-22 on the other (the one that can't run gphoto at all.)

      I had one of those CF-IDE bridges for about a year, and it sucked really, really hard. It completely screwed up everything, like, it killed my bus bandwidth. It took two weeks of tinkering to get it to work at all, dicking around with IRQs and so on (IRQs! In this modern world!) and --bonus-- if I ever forgot to run "cardctl eject" before popping the card out, it would make the kernel lock up solid.

      I still have it on a shelf somewhere. One day I plan to hit it with a rock.

      • ch says:

        It sounds like you had device containing a PCMCIA bridge. If it supported devices other than CF, it certainly contained a bridge. Yuck.

        You can hook up CF straight to an IDE/ATA controller -- no 'lectronics required. (Best case: put it on a controller w/o a disk on it -- hooking up a slow device and a fast device on the same controller is courting trouble.)

        • jwz says:

          Right, it was a full PCMCIA bridge (I tried both ISA and PCI versions.) Then I'd put the CF in there with this little adapter dingus that converts CF to PCMCIA. Anyway, that was pure pain.

  6. hepkitten says:

    You made me spittake. :(

    are you excited about WIL WHEATON?!?!? Come on?! WHO ISNT?!?!?