My wife has been complaining about some problem she was having looking at a few pictures she took with our digital camera. She said the error message was something like, “Unable to view image — Bad image file”. I kind of blew her off after using the camera without any problems. Then, yesterday she asked me to load them onto the win xp machine we use to store our images and I found the problem she was talking about.
Sure enough, there were some corrupted images on the card. I tried to perform the sync 3 or 4 times before I realized that it just wasn’t going to happen. I tried to find the images on the camera and delete them but it just locked the camera up when I would try to select a bad image. Still no luck. After a little brainstorming I decieded it was time to plug the camera into my RH9 box and mount the CF card and see what I could do. I had done this about a month or so ago and was actually going to write an article about it on uptime, but before I got around to it a friend had an article up on the same subject (see Frank Merenda’s article). Anyways, I plugged the camera into my usb slot, openned a terminal window and tailed my /var/log/message file, and then powered up the camera.
Looking at my tail. I see the camera/CF card are clearly recognized and the USB driver sets up “SCSI emulation” on my card.
Nov 9 22:46:27 localhost kernel: hub.c: new USB device 00:1f.4-1, assigned address 2
Nov 9 22:46:27 localhost kernel: usb.c: USB device 2 (vend/prod 0x4b0/0x114) is not claimed by any active driver.
Nov 9 22:46:30 localhost /etc/hotplug/usb.agent: Setup usb-storage for USB product 4b0/114/100
Nov 9 22:46:30 localhost kernel: Initializing USB Mass Storage driver…
Nov 9 22:46:30 localhost kernel: usb.c: registered new driver usb-storage
Nov 9 22:46:30 localhost kernel: scsi1 : SCSI emulation for USB Mass Storage devices
Nov 9 22:46:30 localhost kernel: Vendor: NIKON Model: NIKON DSC E3100 Rev: 1.00
Nov 9 22:46:30 localhost kernel: Type: Direct-Access ANSI SCSI revision: 02
Nov 9 22:46:30 localhost kernel: USB Mass Storage support registered.
Next I mount the camera
[root@localhost root]# mount /dev/sda1 /mnt
[root@localhost root]# ls /mnt
dcim misc nikon001.dsc
So I’m “in business”. Now I need to find my pics. They end up being in
Now that I was in the card I needed to try to find the “bad images”. I achieved this by starting at the top and just opening each image in my browser. The first two opened fine, but then I was getting an, “unable to open image” message. I simply worked down the list until I could open one, and then deleted everything in-between. Not the most scientific process, but it worked great. How I would have done this without a linux machine? I have no idea.
This Post Has 7 Comments
Without Linux you _may_ have been able to replicate the process with a CF-card reader. Those are pretty slick. Linux makes the simplicity of solutions so much more comfortable (yes, doubting-reader, that’s simple once you learn linux).
Any idea how it got corrupted?
Ahhh. Don’t you just love the elegance and power of the command line? The satisfaction you get from examining logs, researching errors and solving problems like this is what makes the CLI so great.
I hadn’t thought about using a CF card reader. I guess it just seemed like a waste of $10-30 (not sure what they cost) because you can get the card “mounted” with nothing more then the software that came with the camera.
If the card reader “mounts” the card like another drive then I guess I could have done the same thing with a reader and WXP, but doesn’t it sound a lot cooler the way I ended up fixing the problem?
I think the reason the images got corrupted was the camera was running out of “juice” and couldn’t perform the “store” operation. It had just enough power to “flash” which made my wife think it worked. Then it would flash up the error message, that my wife ignored. She would then try again, and get the same problem. Eventually, she gave the camera to me, I put “fresh” batteries in and everything worked….. until I tried to sync the images.
Whoa… that was a long comment.
YES, the command-line is great. And I can and want to learn a new trick to use there every day.
I ended up buying a card reader because (1) I knew it would work in Linux with no problems, and (2) To save battery life in the camera when downloading images. My past experience (a long time ago before the latest camera!) was that downloading the pictures from the camera was the fastest way to kill your battery life. I don’t know how the newer cameras are, though. I got about 120 pictures with the batteries that came with the camera, with flash. I’ve put in really good batteries this time and I’m curious to see how they hold up.
Glad you fixed the camera! I think you would have had to buy a card reader, read the card under windows, and then deleted the bad images. I don’t know how else you could have fixed it under windows.
Yeah, I think I’m gonna use some Christmas money to pick up a card reader. I don’t know why I never thought about the battery drainage thing. Both my cameras have used rechargeable batteries, but still, they get drained when I download my pics.