Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Tip of the Day: Repairing a corrupted DCIM card



One of my SmartMedia cards that I use with my ancient Olympus digital
camera started taking about 60 seconds to write each photo (it
normally takes about 3-5, depending on image size). I had not used the
card in ages, and when I mounted it in Linux, I saw stuff like this:

: jmglov@example.com; find /mnt/smartmedia/ -name \*.jpg
find: /mnt/smartmedia/100olymp: Input/output error
/mnt/smartmedia/p1010001.jpg
find: /mnt/smartmedia/.: Input/output error
find: /mnt/smartmedia/r??$3br�.
: Input/output error
find: /mnt/smartmedia/????????.???: Input/output error
: jmglov@example.com; mv -i /mnt/smartmedia/*.jpg ./
mv: reading `/mnt/smartmedia/p1010003.jpg': Input/output error
mv: overwrite `./p1010004.jpg'? n
mv: reading `/mnt/smartmedia/p7160009.jpg': Input/output error

Here's how I fixed it:

1. Unmounted the card: umount /dev/sdc1
2. Deleted the main partition and recreated it: sudo fdisk /dev/sdc
a. Command (m for help): p

Disk /dev/sdc: 32 MB, 32768000 bytes
8 heads, 16 sectors/track, 500 cylinders
Units = cylinders of 128 * 512 = 65536 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         500       31982+   4  FAT16 <32M

b. Command (m for help): d
Selected partition 1

c. Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-500, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-500, default 500):
Using default value 500

d. Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 1
Changed system type of partition 1 to 1 (FAT12)

e. Command (m for help): a
Partition number (1-4): 1

f. Command (m for help): p

Disk /dev/sdc: 32 MB, 32768000 bytes
8 heads, 16 sectors/track, 500 cylinders
Units = cylinders of 128 * 512 = 65536 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         500       31992    1  FAT12

g. Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.


3. Created FAT12 filesystem on the newly created partition: sudo mkdosfs -F 12 /dev/sdc1 4. Used in camera normally

This should work more or less the same way for any type of memory card
media used in digital cameras. The best thing to do if you have a
corrupted card is to stick a healthy card in your card reader, plug it
in to your Linux box, and run: fdisk -l /dev/sdc (replace sdc with the
actual device of your card; you can see this by running the following
command before plugging in the card reader and watching the output:
tail -f /var/log/messages). Note the output (save it in a text file or
simply leave it open in one terminal and open a new one to do your
work), then recreate the partition and filesystem on the corrupt card
to match.

--
Cheers,
Josh

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links