All of lore.kernel.org
 help / color / mirror / Atom feed
* Is there a way to limit VFAT allocation?
@ 2006-10-16 10:06 Zoltan Boszormenyi
  2006-10-16 10:25 ` Prakash Punnoor
  2006-10-16 10:37 ` Grzegorz Kulewski
  0 siblings, 2 replies; 6+ messages in thread
From: Zoltan Boszormenyi @ 2006-10-16 10:06 UTC (permalink / raw)
  To: linux-kernel

Hi,

I have bought a 2GB MP3 player / flash disk
that erroneously partitions and formats its storage.
The built-in firmware has an off-by-one bug that
creates the partition one cylinder larger that the
disk size allows and then it formats the VFAT fs
according to the buggy partition size. No wonder
when I try to copy large amounts of data to the
flash disk it detects errors and then remounts it
read-only.

I tried to repartition and reformat it three times
with different mformat or mkdosfs options
but as soon as I remove it from the USB port,
the device detects changed disk format and
automatically reformats itself again, so it
stays buggy.

Here's the excerpt from the logs on one occasion
I tried to copy some large stuff onto it:

Oct  3 22:56:31 host-81-17-177-202 kernel: SCSI device sdb: 4095765 
512-byte hdwr sectors (2097 MB)
Oct  3 22:56:31 host-81-17-177-202 kernel: sdb: Write Protect is off
Oct  3 22:56:32 host-81-17-177-202 kernel: sdb: assuming drive cache: 
write through
Oct  3 22:56:32 host-81-17-177-202 kernel: SCSI device sdb: 4095765 
512-byte hdwr sectors (2097 MB)
Oct  3 22:56:32 host-81-17-177-202 kernel: sdb: Write Protect is off
Oct  3 22:56:32 host-81-17-177-202 kernel: sdb: assuming drive cache: 
write through
Oct  3 22:56:33 host-81-17-177-202 kernel:  sdb: sdb1
Oct  3 22:56:33 host-81-17-177-202 kernel:  sdb: p1 exceeds device capacity
Oct  3 22:56:33 host-81-17-177-202 kernel: sd 6:0:0:0: Attached scsi 
removable disk sdb
Oct  3 22:56:33 host-81-17-177-202 kernel: sd 6:0:0:0: Attached scsi 
generic sg1 type 0
Oct  3 22:56:33 host-81-17-177-202 kernel: sd 5:0:0:0: Attached scsi 
removable disk sdc
Oct  3 22:56:33 host-81-17-177-202 kernel: sd 5:0:0:0: Attached scsi 
generic sg2 type 0
Oct  3 22:56:33 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095616
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095617
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095618
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095619
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095620
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095621
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095622
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095623
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095616
Oct  3 22:56:34 host-81-17-177-202 kernel: Buffer I/O error on device 
sdb1, logical block 4095617
Oct  3 22:56:34 host-81-17-177-202 kernel: SELinux: initialized (dev 
sdb1, type vfat), uses genfs_contexts
...
Oct  3 23:26:53 host-81-17-177-202 kernel: FAT: Filesystem panic (dev sdb1)
Oct  3 23:26:53 host-81-17-177-202 kernel:     fat_get_cluster: invalid 
cluster chain (i_pos 0)
Oct  3 23:26:53 host-81-17-177-202 kernel:     File system has been set 
read-only
...
Oct  3 23:31:35 host-81-17-177-202 kernel: FAT: Filesystem panic (dev sdb1)
Oct  3 23:31:35 host-81-17-177-202 kernel:     fat_get_cluster: invalid 
cluster chain (i_pos 0)
Oct  3 23:35:33 host-81-17-177-202 kernel: FAT: Filesystem panic (dev sdb1)
Oct  3 23:35:33 host-81-17-177-202 kernel:     fat_bmap_cluster: request 
beyond EOF (i_pos 47395744)
Oct  3 23:35:33 host-81-17-177-202 kernel: FAT: Filesystem panic (dev sdb1)
Oct  3 23:35:33 host-81-17-177-202 kernel:     fat_bmap_cluster: request 
beyond EOF (i_pos 47395744)
Oct  3 23:35:33 host-81-17-177-202 kernel: FAT: Filesystem panic (dev sdb1)
Oct  3 23:35:33 host-81-17-177-202 kernel:     fat_bmap_cluster: request 
beyond EOF (i_pos 47395744)
Oct  3 23:35:33 host-81-17-177-202 kernel: FAT: Filesystem panic (dev sdb1)
Oct  3 23:35:33 host-81-17-177-202 kernel:     fat_bmap_cluster: request 
beyond EOF (i_pos 47395744)
...

Unfortunately, the firmware is not upgradeable.
The device in question is a Telstar UFM-102B.

Is there a way to tell the VFAT driver to exclude
the last N sectors from the allocation strategy?

Best regards,
Zoltán Böszörményi


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is there a way to limit VFAT allocation?
  2006-10-16 10:06 Is there a way to limit VFAT allocation? Zoltan Boszormenyi
@ 2006-10-16 10:25 ` Prakash Punnoor
  2006-10-16 10:57   ` Zoltan Boszormenyi
  2006-10-16 10:37 ` Grzegorz Kulewski
  1 sibling, 1 reply; 6+ messages in thread
From: Prakash Punnoor @ 2006-10-16 10:25 UTC (permalink / raw)
  To: Zoltan Boszormenyi; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

Am Montag 16 Oktober 2006 12:06 schrieb Zoltan Boszormenyi:
> Is there a way to tell the VFAT driver to exclude
> the last N sectors from the allocation strategy?

Can't you mark that clusters as bad with a diskeditor?
-- 
(°=                 =°)
//\ Prakash Punnoor /\\
V_/                 \_V

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is there a way to limit VFAT allocation?
  2006-10-16 10:06 Is there a way to limit VFAT allocation? Zoltan Boszormenyi
  2006-10-16 10:25 ` Prakash Punnoor
@ 2006-10-16 10:37 ` Grzegorz Kulewski
  1 sibling, 0 replies; 6+ messages in thread
From: Grzegorz Kulewski @ 2006-10-16 10:37 UTC (permalink / raw)
  To: Zoltan Boszormenyi; +Cc: linux-kernel

Hi,

On Mon, 16 Oct 2006, Zoltan Boszormenyi wrote:
> I have bought a 2GB MP3 player / flash disk
> that erroneously partitions and formats its storage.
> The built-in firmware has an off-by-one bug that
> creates the partition one cylinder larger that the
> disk size allows and then it formats the VFAT fs
> according to the buggy partition size. No wonder
> when I try to copy large amounts of data to the
> flash disk it detects errors and then remounts it
> read-only.
>
> I tried to repartition and reformat it three times
> with different mformat or mkdosfs options
> but as soon as I remove it from the USB port,
> the device detects changed disk format and
> automatically reformats itself again, so it
> stays buggy.
[snip]
> Unfortunately, the firmware is not upgradeable.
> The device in question is a Telstar UFM-102B.
>
> Is there a way to tell the VFAT driver to exclude
> the last N sectors from the allocation strategy?

Maybe try to setup device mapper linear mapping backed by portion of that 
partition that is ok (== one cylinder smaller) instead of messing with 
filesystem drivers. And then create filesystem on top of that new device.


Grzegorz Kulewski


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is there a way to limit VFAT allocation?
  2006-10-16 10:25 ` Prakash Punnoor
@ 2006-10-16 10:57   ` Zoltan Boszormenyi
  2006-10-16 17:10     ` Rene Scharfe
  0 siblings, 1 reply; 6+ messages in thread
From: Zoltan Boszormenyi @ 2006-10-16 10:57 UTC (permalink / raw)
  To: Prakash Punnoor; +Cc: linux-kernel

Prakash Punnoor írta:
> Am Montag 16 Oktober 2006 12:06 schrieb Zoltan Boszormenyi:
>   
>> Is there a way to tell the VFAT driver to exclude
>> the last N sectors from the allocation strategy?
>>     
>
> Can't you mark that clusters as bad with a diskeditor?
>   

Can you suggest one that works on Linux?
Or which bits should I change if I use LDE?
(lde.sourceforge.net)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is there a way to limit VFAT allocation?
  2006-10-16 10:57   ` Zoltan Boszormenyi
@ 2006-10-16 17:10     ` Rene Scharfe
  2006-10-17  7:27       ` Zoltan Boszormenyi
  0 siblings, 1 reply; 6+ messages in thread
From: Rene Scharfe @ 2006-10-16 17:10 UTC (permalink / raw)
  To: Zoltan Boszormenyi; +Cc: linux-kernel

Zoltan Boszormenyi schrieb:
> Prakash Punnoor írta:
>> Am Montag 16 Oktober 2006 12:06 schrieb Zoltan Boszormenyi:
>>  
>>> Is there a way to tell the VFAT driver to exclude
>>> the last N sectors from the allocation strategy?
>>>     
>>
>> Can't you mark that clusters as bad with a diskeditor?
>>   
> 
> Can you suggest one that works on Linux?
> Or which bits should I change if I use LDE?
> (lde.sourceforge.net)

Try mbadblocks, part of the Mtools package (http://mtools.linux.lu/).
If it doesn't help, and you are brave, you may want to play with
mdoctorfat, which comes with Mtools, too, but is hidden for some reason. :->

René

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is there a way to limit VFAT allocation?
  2006-10-16 17:10     ` Rene Scharfe
@ 2006-10-17  7:27       ` Zoltan Boszormenyi
  0 siblings, 0 replies; 6+ messages in thread
From: Zoltan Boszormenyi @ 2006-10-17  7:27 UTC (permalink / raw)
  To: Rene Scharfe; +Cc: linux-kernel

Rene Scharfe írta:
> Zoltan Boszormenyi schrieb:
>   
>> Prakash Punnoor írta:
>>     
>>> Am Montag 16 Oktober 2006 12:06 schrieb Zoltan Boszormenyi:
>>>  
>>>       
>>>> Is there a way to tell the VFAT driver to exclude
>>>> the last N sectors from the allocation strategy?
>>>>     
>>>>         
>>> Can't you mark that clusters as bad with a diskeditor?
>>>   
>>>       
>> Can you suggest one that works on Linux?
>> Or which bits should I change if I use LDE?
>> (lde.sourceforge.net)
>>     
>
> Try mbadblocks, part of the Mtools package (http://mtools.linux.lu/).
> If it doesn't help, and you are brave, you may want to play with
> mdoctorfat, which comes with Mtools, too, but is hidden for some reason. :->
>
> René
>   

Thanks. I have set up my /root/.mtoolsrc and:

# mbadblocks x:
plain_io: Input/output error
Bad cluster 63985 found
plain_io: Input/output error
Bad cluster 63986 found
plain_io: Input/output error
Bad cluster 63987 found
plain_io: Input/output error
Bad cluster 63988 found
plain_io: Input/output error
Bad cluster 63989 found

After unplugging the device didn't reformat itself.
Filling the disk seems to be working. It gives me
"disk full" without any new "Buffer I/O error on device sdc1"
or FAT panic messages in the kernel logs.

Thanks and best regards,
Zoltán Böszörményi


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-17  7:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-16 10:06 Is there a way to limit VFAT allocation? Zoltan Boszormenyi
2006-10-16 10:25 ` Prakash Punnoor
2006-10-16 10:57   ` Zoltan Boszormenyi
2006-10-16 17:10     ` Rene Scharfe
2006-10-17  7:27       ` Zoltan Boszormenyi
2006-10-16 10:37 ` Grzegorz Kulewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.