Here is what happened:
I used the Laptop and accessed some data on my usb stick. Then I closed the Laptop putting the system into sleep mode. The USB-Stick was still plugged in. After the laptop was completely in sleep I removed the Stick (the light was off, so it must have been without power). I woke up the laptop today without the USB-Stick. Now when I re-plug it, the filesystem will not be mounted automatically.
I tried to manually mount it:
chi mnt # mount -t vfat /dev/disk/by-id/usb-JetFlash_Transcend_4GB_QTMFKJQQ-0\:0-part1 usb/ mount: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error Manchmal liefert das Syslog wertvolle Informationen – versuchen Sie dmesg | tail oder so
dmesg | tail I found the following:
FAT-fs (sdb1): bogus number of FAT structure FAT-fs (sdb1): Can't find a valid FAT filesystem
So I tried to do
fsck.vfat on the partition of the stick, to see if it can somehow fix it:
chi mnt # fsck.vfat /dev/disk/by-id/usb-JetFlash_Transcend_4GB_QTMFKJQQ-0\:0-part1 dosfsck 3.0.9, 31 Jan 2010, FAT32, LFN Cluster size is zero.
Is there some way to repair the filesystem on the stick using linux tools? I am using gentoo.
Also shouldn't this behavior be considered a bug or at least dangerous? Removing the stick while the system is in sleep mode sounds like a common use-case to me. Also if you remove it, it is very easy to forget to put it back in before you turn the system back on, and I don't think this should kill your file-system like this. I am willing to report this bug, but I don't know which mailing list/bugtracker would be the correct one.
I found some suggestions online. However if I try this using:
dd if=/dev/disk/by-id/usb-JetFlash_Transcend_4GB_QTMFKJQQ-0\:0-part1 of=sector6.bin bs=512 count=1 skip=6 conv=noerror,sync dd if=sector6.bin of=/dev/disk/by-id/usb-JetFlash_Transcend_4GB_QTMFKJQQ-0\:0-part1 bs=512 count=1 conv=noerror,sync,notrunc
I still get the same error afterwards. I also tried using
CHKDSK F: \R \T under windows as suggested by some posts, but this tool only reports the drive as
RAW and thus unsuported.