Skip to contentSkip to conversation

*FAT problem in 2.6.0-test8

DISCUSSION Vid Strpic 3 participants 9 messages Oct 24, 2003 – Oct 25, 2003

lore
Share & tools
lore

Vid Strpic

author
#0 lore raw

Hi...

Yesterday, I just wanted to download some pics from a Smartmedia card from my camera. I put the card into the reader (USB Mass Storage Flash Card Reader, Manufacturer: EZ, Serial Number: 9876543210ABCDEF, driver is usb-storage and working well now, I had problems earlier), but the kernel doesn't recognize FAT filesystem on the card...

Oct 23 17:19:45 moria kernel: VFS: Can't find a valid FAT filesystem on dev sda1.
Oct 23 17:28:20 moria kernel: VFS: Can't find a valid FAT filesystem on dev loop0.

The second line was, I dd-ed the card onto a disk file and tried to mount that... no luck.

More messages:

Oct 23 17:19:01 moria kernel: FAT: invalid first entry of FAT (0xff8 != 0x0)

Luckily, I have a 2.4 machine around, I tried to mount the resulting disk image (NFS) on that machine (-o loop ofcourse), and it worked perfectly... kernel is 2.4.22.

On 2.6 machine, modules loaded were fat and vfat... fstab entry in question is:

/dev/sda1 /mnt/sm vfat user,noauto,owner,rw 1 1

And yes, I tried mounting the filesystem in question as fat _and_ vfat... nothing works.

Not that I need FAT filesystems so very much, but I need them here and there, and it would be a very NOT nice thing not to have drivers working :(

Any ideas what's wrong?

Signature · 3 lines
           [email protected], IRC:*@Martin, /bin/zsh. C|N>K
Linux moria 2.6.0-test8 #1 Mon Oct 20 16:19:20 CEST 2003 i686
 12:24:38 up 11:10,  1 user,  load average: 0.74, 0.33, 0.25
#1 lore raw
Quoted 6 lines · Vid Strpic

Yesterday, I just wanted to download some pics from a Smartmedia card from my camera. I put the card into the reader (USB Mass Storage Flash Card Reader, Manufacturer: EZ, Serial Number: 9876543210ABCDEF, driver is usb-storage and working well now, I had problems earlier), but the kernel doesn't recognize FAT filesystem on the card...

Quoted 7 lines
Oct 23 17:19:01 moria kernel: FAT: invalid first entry of FAT (0xff8 != 0x0)

Luckily, I have a 2.4 machine around, I tried to mount the resulting disk image (NFS) on that machine (-o loop ofcourse), and it worked perfectly... kernel is 2.4.22.

Any ideas what's wrong?

Go to linux/fs/fat, edit inode.c, comment the bit

        if (FAT_FIRST_ENT(sb, media) != first
            && (media != 0xf8 || FAT_FIRST_ENT(sb, 0xfe) != first)) {
                if (!silent) {
                        printk(KERN_ERR "FAT: invalid first entry of FAT "
                               "(0x%x != 0x%x)\n",
                               FAT_FIRST_ENT(sb, media), first);
                }
                goto out_invalid;
        }

out by putting #if 0 ... #endif around it.

How was this card formatted?

#2 lore raw
Quoted 9 lines · Andries Brouwer
Quoted 7 lines · Vid Strpic

Yesterday, I just wanted to download some pics from a Smartmedia card from my camera. I put the card into the reader (USB Mass Storage Flash Card Reader, Manufacturer: EZ, Serial Number: 9876543210ABCDEF, driver is usb-storage and working well now, I had problems earlier), but the kernel doesn't recognize FAT filesystem on the card...

Oct 23 17:19:01 moria kernel: FAT: invalid first entry of FAT (0xff8 != 0x0)

[...]

Quoted 1 line

How was this card formatted?

It looks like it doesn't conform to Microsoft's or SmartMedia's specifications.

Yes. It will be important to know how it was formated.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#3 lore raw
Quoted 4 lines · OGAWA Hirofumi

It looks like it doesn't conform to Microsoft's or SmartMedia's specifications.

Yes. It will be important to know how it was formated.

Yesterday I wondered whether I should propose a patch, say something like

inode.c Sat Oct 25 00:04:18 2003 renamed from linux/2.6/linux-2.6.0test6/linux/fs/fat/inode.c Sat Aug 9 22:16:54 2003 +8 -4
@@ -931,13 +931,17 @@
                error = first;
                goto out_fail;
        }
-       if (FAT_FIRST_ENT(sb, media) != first
-           && (media != 0xf8 || FAT_FIRST_ENT(sb, 0xfe) != first)) {
-               if (!silent) {
+       if (FAT_FIRST_ENT(sb, media) == first) {
+               /* all is as it should be */
+       } else if (media == 0xf8 && FAT_FIRST_ENT(sb, 0xfe) == first) {
+               /* bad, reported on pc9800 */
+       } else if (first == 0) {
+               /* bad, reported once with a SmartMedia card */
+       } else {
+               if (!silent)
                        printk(KERN_ERR "FAT: invalid first entry of FAT "
                               "(0x%x != 0x%x)\n",
                               FAT_FIRST_ENT(sb, media), first);
-               }
                goto out_invalid;
        }
 

but maybe a single report does not suffice. It would be good to confirm that certain devices write 0 there. (I would have asked the reporter to do "dd if=/dev/zero of=/dev/something" and reinsert the card into the camera, but fiddling with smartmedia cards is a bit dangerous - not all readers and not all cameras are able to recover from such a situation, so the card might become unusable without access to other readers or other cameras.)

Andries

[BTW - Does anyone have more information about this other nonstandard value, apparently found on pc9800?]

#4 lore raw
Quoted 2 lines · Andries Brouwer

[BTW - Does anyone have more information about this other nonstandard value, apparently found on pc9800?]

IIRC, it seems it was used by DOS of PC98 series.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
author
#5 lore raw
In reply to OGAWA Hirofumi
Quoted 10 lines · OGAWA Hirofumi
Quoted 9 lines · Andries Brouwer
Quoted 8 lines · Vid Strpic

Yesterday, I just wanted to download some pics from a Smartmedia card from my camera. I put the card into the reader (USB Mass Storage Flash Card Reader, Manufacturer: EZ, Serial Number:
9876543210ABCDEF, driver is usb-storage and working well now, I had problems earlier), but the kernel doesn't recognize FAT filesystem on the card...

Oct 23 17:19:01 moria kernel: FAT: invalid first entry of FAT

(0xff8 != 0x0)

Quoted 4 lines
Quoted 1 line

How was this card formatted?

It looks like it doesn't conform to Microsoft's or SmartMedia's specifications.
Yes. It will be important to know how it was formated.

Well, I really don't know if it was formatted when I bought it, 2 years ago. What puzzles me, is that 2.4 mounts it normally...

This is the hex dump of begginning (problematic no-name 64Mb card):

0000000: e900 002a 6453 777c 4948 4300 0220 0100  ...*dSw|IHC.. ..
0000010: 0200 0100 00f8 0c00 2000 0800 3700 0000  ........ ...7...
0000020: c9f3 0100 0000 0000 0000 0000 0000 0000  ................
0000030: 0000 0000 0000 4641 5431 3220 2020 0000  ......FAT12   ..
0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................

And this is the SanDisk 32Mb card which mounts normally under 2.6:

0000000: e900 0020 2020 2020 2020 2000 0220 0100  ...        .. ..
0000010: 0200 01dd f9f8 0600 1000 0800 2300 0000  ............#...
0000020: 0000 0000 0000 2900 0000 004e 4f20 4e41  ......)....NO NA
0000030: 4d45 2020 2020 4641 5431 3220 2020 0000  ME    FAT12   ..
0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................

Maybe I should try to reformat the card in the reader? My camera has 'delete all images' but no 'format card' I'm sorry...

Signature · 4 lines
           [email protected], IRC:*@Martin, /bin/zsh. C|N>K
Linux moria 2.6.0-test8 #1 Mon Oct 20 16:19:20 CEST 2003 i686
 12:52:51 up 19:36,  1 user,  load average: 0.14, 0.25, 0.18
Moderna algebra je kad u 4 ujutro vadis korijen iz nepoznate.
#6 lore raw
Quoted 6 lines · Vid Strpic
Quoted 3 lines

It looks like it doesn't conform to Microsoft's or SmartMedia's specifications.
Yes. It will be important to know how it was formated.

Well, I really don't know if it was formatted when I bought it, 2 years ago. What puzzles me, is that 2.4 mounts it normally...

Yes, 2.4 doesn't check it field.

Quoted 8 lines

This is the hex dump of begginning (problematic no-name 64Mb card):

0000000: e900 002a 6453 777c 4948 4300 0220 0100  ...*dSw|IHC.. ..
0000010: 0200 0100 00f8 0c00 2000 0800 3700 0000  ........ ...7...
0000020: c9f3 0100 0000 0000 0000 0000 0000 0000  ................
0000030: 0000 0000 0000 4641 5431 3220 2020 0000  ......FAT12   ..
0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
Quoted 7 lines

And this is the SanDisk 32Mb card which mounts normally under 2.6:

0000000: e900 0020 2020 2020 2020 2000 0220 0100  ...        .. ..
0000010: 0200 01dd f9f8 0600 1000 0800 2300 0000  ............#...
0000020: 0000 0000 0000 2900 0000 004e 4f20 4e41  ......)....NO NA
0000030: 4d45 2020 2020 4641 5431 3220 2020 0000  ME    FAT12   ..
0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................

On these FAT formats, the target field should be offset 512.

Quoted 2 lines

Maybe I should try to reformat the card in the reader? My camera has 'delete all images' but no 'format card' I'm sorry...

Um.. Could you please test to reformat? Of course, do it after backup the your disk image.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
author
#7 lore raw
Quoted 7 lines · OGAWA Hirofumi
Quoted 5 lines · Vid Strpic
Quoted 3 lines

It looks like it doesn't conform to Microsoft's or SmartMedia's specifications.
Yes. It will be important to know how it was formated.

Well, I really don't know if it was formatted when I bought it, 2 years ago. What puzzles me, is that 2.4 mounts it normally...

Yes, 2.4 doesn't check it field.

Obviously. I compared the drivers 2.4.22 -> test8, and diff -u is about 1000 lines, a lot.

Quoted 12 lines
Quoted 12 lines

This is the hex dump of begginning (problematic no-name 64Mb card):

0000000: e900 002a 6453 777c 4948 4300 0220 0100  ...*dSw|IHC.. ..
0000010: 0200 0100 00f8 0c00 2000 0800 3700 0000  ........ ...7...
0000020: c9f3 0100 0000 0000 0000 0000 0000 0000  ................
0000030: 0000 0000 0000 4641 5431 3220 2020 0000  ......FAT12   ..
0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
And this is the SanDisk 32Mb card which mounts normally under 2.6:
0000000: e900 0020 2020 2020 2020 2000 0220 0100  ...        .. ..
0000010: 0200 01dd f9f8 0600 1000 0800 2300 0000  ............#...
0000020: 0000 0000 0000 2900 0000 004e 4f20 4e41  ......)....NO NA
0000030: 4d45 2020 2020 4641 5431 3220 2020 0000  ME    FAT12   ..
0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
Quoted 1 line

On these FAT formats, the target field should be offset 512.

Hm.

Quoted 4 lines
Quoted 2 lines

Maybe I should try to reformat the card in the reader? My camera has 'delete all images' but no 'format card' I'm sorry...

Um.. Could you please test to reformat? Of course, do it after backup the your disk image.

Backups were done yesterday, I'm on the backup-freak side ;)

Just reformatted, it works - used mkdosfs -F 12 -v /dev/sda1, camera reads the card and can write picture on it...

Reformatted card now can be mounted by standard fat.ko ...

Signature · 4 lines
           [email protected], IRC:*@Martin, /bin/zsh. C|N>K
Linux moria 2.6.0-test8 #1 Mon Oct 20 16:19:20 CEST 2003 i686
 19:30:50 up 1 day,  2:14,  1 user,  load average: 0.97, 1.51, 0.87
Najkraci C program se sastoji od osam znakova: main(){} (C)Hrv, 2002.
#8 lore raw
Quoted 11 lines · Vid Strpic
Quoted 4 lines
Quoted 2 lines

Maybe I should try to reformat the card in the reader? My camera has 'delete all images' but no 'format card' I'm sorry...

Um.. Could you please test to reformat? Of course, do it after backup the your disk image.

Backups were done yesterday, I'm on the backup-freak side ;)

Just reformatted, it works - used mkdosfs -F 12 -v /dev/sda1, camera reads the card and can write picture on it...

Reformatted card now can be mounted by standard fat.ko ...

Ok. Your camera isn't buggy, but your SmartMedia's card had the bad format. (Unfortunately, it sounds like reason is unknown... Some SmartMedia may have this bad format.)

Thanks for testing it.

Signature · 1 line
OGAWA Hirofumi <[email protected]>