Friday, 8 August 2008

Ahhhh my mobile's memory card gone got corrupted.

The wonders of vfat and wm6 left me with a corrupted memory card on my pocket pc mobile phone. In the digital camera folder no-less. But don't worry, this story has a happy ending!

Trying to perform ls on the dcim folder gave me:

ls: cannot access 100media: Input/output error

dmesg said:

FAT: Filesystem panic (dev sdb1)
fat_get_cluster: invalid cluster chain (i_pos 0)

so first-things-first, I made a direct copy of the memory card via

dd if=/dev/sdb1 of=memorycard.iso bs=2048

I could then play-around with the iso image without having to worry about loosing data (It took a while to copy the 4Gb over usb). I had to run this as root.

To fix the problem I ran fsck (I changed the ownership (chown) of the iso to my user first so I didn't have to run fsck as root.)

fsck.vfat -a memorycard.iso

This reported:

dosfsck 2.11, 12 Mar 2005, FAT32, LFN
/dcim/100media
Contains a free cluster (8712). Assuming EOF.
Reclaimed 5225 unused clusters (171212800 bytes) in 246 chains.
Performing changes.
memorycard.iso: 8454 files, 33037/124112 clusters

I then mounted the iso image:

sudo mount -o loop memorycard.iso /mnt/temp


In the root of the iso were lots of .rec files. These turned out to be perfectly preserved copies of the lost files (minus the file name). I opened the folder in a file manager and it recognised the files as jpgs and mp4s. All that remainded was to rename the files and format the memory card.

No comments:

Post a Comment