View Single Post
  #18   Report Post  
John Stumbles
 
Posts: n/a
Default How to tell if CF card is faulty?

"Andy Baxter" wrote in message
news
John Stumbles said:


....

Is there any way of testing to be sure, using what I have he the

camera
itself, a usb card reader, linux and win2k systems, some loo rolls and
sticky-back plastic ... :-) ?


how about this?

$ dd if=/dev/random of=/tmp/cf.img bs=1024 count=$((1024*128))

to make an image of random bytes.

$ md5sum /tmp/cf.img

to get a checksum for it

$ dd if=/tmp/cf.img bs=1024 of=/dev/cf-device

to copy it to the card

$ md5sum /dev/cf-device

to checksum the card
if the sums match, the card is probably ok.
maybe make a script to do this n times to be sure.


Thanks that did the trick.

I actually used /dev/urandom as /dev/random looked like taking until next
century to produce 128M. I also found that $((1024*128)) was bigger than the
CF card size, so used effectively:

# fill card with random stuff
$dd if=/dev/random of=/dev/cf-device

# read from card
$ dd if=/dev/cf-device of=/tmp/cf.img

# checksum card
$ md5sum /dev/cf-device

# checksum image file
$ md5sum /tmp/cf.img

Sure enough the md5s were different. Possibly diff might have done the trick
for that.

I guess apart from random data various patterns including all 0s, all 1s,
010101... (x55, xAA) and so on might gie a more rigorous test.