Problems FAT16 format..and some more

Thomas Doerfler Thomas.Doerfler at
Mon Jan 17 07:44:16 UTC 2005

Hello Daniel,

> Hello Thomas!
> I need some help :)

I'll do what I can...
> When a format 1 gb disk with Fat16 it goes corrupt. I´ve tested both cluster
> 16384 and 32768 with sector size 512. When dos_fs tries to read the volume
> information it just says invalid argument.

What happens during the "msdos_format" function? Is the return 
status ok?

Let us do some computations: You have a 1GB disk, and it hast 
blocks of 16384 or 32768 bytes each. This means:

1GB/16384=65536 blocks. 
1GB/32768=32768 blocks. 

Any disk with more than 65524 blocks is a FAT32 disk. So I would 
hope, that the "format" code would either reject requested 
parameters of FAT16 and 16K blocks, or it would modify your 

-> Can you set a breakpoint in the "msdos_format" function just 
after the msdos_format_determine_fmt_params function call, and 
inspect the contents of the fmt_params data structure?

Your second configuration, 32K blocks, should be ok as FAT16.

 I have tried cluster 16384 and
> sector 512 with FAt32 and it works fine. What can this depend on?

Well, this is a proper configuration, so it SHOULD work!

> Another problem is when i try to format the disk for the second time with a
> working fat32 formatted disk. Most of the cases it seems not to do a proper
> format. Files can still be listed and some times it seems like the root
> director is not cleared?? Just garbage is shown in a list of files.
> I use the bdbuf configuration 1 so it should not be the cache that is the
> problem. If i use a large cache and do a format, the whole cache becomes
> dirty or???

dosfs keeps some internal values for each mounted disk. Did you 
properly unmount your disk before calling format and mount it 
again afterwards? This is VERY important to keep things working.

> Can you help me understand what those problems can depend on and tell me any
> other valuable information related to the format.???

When you still have incompatibilities between "msdos_format" and 
mounting, maybe inspecting "fmt_params" and stepping through the 
function "msdos_initialize_support" might give you more 
insights, what goes wrong and which parameters are considered 
wrong during the mount process.

I would love to see some dumps of your system, especially the 
"fmt_params" structure in various configurations.

By the way: up to now I tested "msdos_format" only on big-endian 
systems, so there is always the chance of a incompatibility on 
little endian systems like i386.


> Thanks
> Daniel Gustvsson

IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at
PGP public key available at: http://www.imd-

More information about the users mailing list