View Single Post
Posts: 10 | Thanked: 5 times | Joined on Jul 2008
#8
Originally Posted by tobyr21 View Post
ZZZY,
I think I need to run a Linux tool to clean the file structure. ...
-toby
Hi Toby,

I don't know why Windoze wouldn't fix it since FAT is still native to some degree... Hmmm... The command to fix the vfat fs is fsck.vfat.

For situations like yours I have set a script that attempts to check/fix both cards at once. At least the mount/umount part has to be run as superuser (root). ALso, the chown part (also as root) seems to be necessary, otherwise you only get read-only access to the cards.

Code:
#!/bin/sh

fsck.vfat -a /dev/mmcblk1p1
fsck.vfat -a /dev/mmcblk0p1
echo attempting to unmount mmc cards
mmc-pre-unmount /media/mmc*
umount -f /media/mmc*
fsck.vfat -a /dev/mmcblk1p1
fsck.vfat -a /dev/mmcblk0p1
mmc-mount /dev/mmcblk0p1 /media/mmc2
mmc-mount /dev/mmcblk1p1 /media/mmc1

chown -R user /media/mmc*/*
chown -R user /media/mmc*/.*
Can't really tell what the mmc-pre-unmount actually does, I assume it attempts to sync the vfat fs to prevent corruption, sort of a "gentler" umount.

The -a switch will attempt repair, however, again, no guarantees that your dir structure or files will be accessible in the end. I would first run without the -a switch just to see what fsck detects.

Hope this helps

Z.

Last edited by zzzy; 2009-02-09 at 01:01. Reason: corrected error in last script