You appear to have 66602 sectors. The number of clusters on that will
necessarily be less, since the reserved sectors and the FATs are not
allocated in clusters.
Looking at your code more closely, you've allocated an excessive
number of sectors to the FAT. Counting the 72 reserved sectors and
the 522 sectors in the (one) FAT, you end up with 66008 data sectors,
and (since you have 512 by clusters), 66008 clusters. Which means you
should only need 516 sectors in a FAT.
The 66600* cut-off for FAT32 for MS is really supposed to be just for
formatting the volume, where MS documents it as being the smallest
volume for formatting FAT32. It's possible there's a bug someplace
and it's being used as such. Another good reason for following the
rules.
*I believe that number comes from taking the normal number of FAT32
reserved sectors, and two copies of the necessary FAT, and that gets
you to about the 65524 cluster limit. Actually I get 66588 as a limit
then, and the limit in the formatting table (66000) is an oddly round
number, or is based on an incorrect maximum FAT size (522 sectors,
which should actually be 516 as I mentioned). Still, the point is:
don't do that, things will get confused. In any event those limits
are really for deciding what cluster sizes to use, and clearly take a
simplified view of the possibilities.
>>>So my OS wont see your FAT32 image.
>>>And according to specs: the minimum size of FAT32 is 32 MB.
>>
>> What he's done is describe the volume as having 66602
>> sectors, and then declaring all but the first 2280
>> clusters as invalid in the FAT.
>
>The 66602 (and the correct number of FAT table sectors) is
>all that's required. The "bad sectors" idea was suggested by
>a Reddit comment.
Well, yes, that's the theory, everyone has understood that approach
(fake the volume size, mark all the extra clusters bad) for decades
now.
>>>> I can confirm that Windows 98 (and I'm assuming DOS) will
>>>> not mount it. However, I'm not concerned with the "old"
>>>> systems (including XP which does work). The 1.44MB FAT32
>>>> floppy disk is only a "technical" novelty.
>>>> The interesting aspect is the adaption of the MikeOS FAT12
>>>> to FAT32. The FAT12 floppy disk (image) has long since been
>>>> the mainstay of the simple OS and standalone system. Now an
>>>> even simpler FAT32 system is available.
>>>
>>>It's interesting that XP seem to ignore its own M$-rules :)
>>
>> I believe it's more likely that it's seeing a completely
>> illogical volume (the number of sectors declared in the
>> BPB vastly exceeds the physical capacity of the device)
>> and refusing to mount that.
>
>It's more likely "assuming" a FAT12 BPB and not finding the
>appropriate values. I have no way of confirming it just now
>(the Win98 machine has no USB), but i would guess that a USB
>flash drive with the image will be correctly mounted by
>Win98/DOS.
Frankly I don't care why it doesn't work. I've given you a perfectly
valid reason why it might not, and you've postulated one that might be
due to a buggy FAT implementation (of which there are many!). Yet the
problem remains, here's a system (which might not be a current popular
system, but was at one time far and away the most popular system
supporting FAT) where your funky format does not work. Can you tell
me that this weird format isn't going to be a problem on any/some/many
of the hundreds of other implementations as well? OTOH, had you stuck
with the common formats, you'd likely work in a lot more places.
>>>But isn't FAT already a dead horse ?
>>>win7 want to be installed on a NT-partition only.
>>
>> Sure, but FAT is used on many removable devices, even if
>> floppies are rare these days, massive numbers of flash
>> drives of various sorts are formatted FAT.
>
>Exactly. Keep in mind that the 1.44MB FAT32 floppy disk is
>just a novelty and even if it didn't work (I was surprised
>it did) it wouldn't invalidate the use of the format on a
>USB flash drive as a simple (simpler) replacement for the
>simple system OS use of the FAT12 floppy disk image.
Fine. So insist that users buy at least a 33MB flash drive, and they
format with 512 byte clusters. And stop making a hash of the root
directory. Of course that leave you with the problem that you
immediately don't work with small flash drives *without* requiring the
user to reformat them. All of this to avoid a minor amount of extra
code to support FAT12/16.
>> Mike has invented a new FS (which is fine), which bears
>> some resemblances to FAT, but is not actually FAT (his
>> handling of the root directory is a major issue). The
>> problem is that he keeps trying to claim it actually works
>> and/or is actually compatible with FAT. To maintain that
>> position he's dismissed multiple issues pointed out to
>> him (in this case, he's just elected to dismiss Win98,
>> likewise he's just ignored the issue that a "real" FAT
>> implementation can break his "FAT" root directory by doing
>> things that are perfectly allowed - for example by
>> creating more files than this volume has pre-allocated root
>> directory entries).
>
>Nothing gets broken. This fact actually supports my 100%
>compatibility claim. It's only a minor technical
>"inconvenience" easily worked around that only effects the
>primary use case. It doesn't need to work on old systems,
>the beginner will be using a new system.
Seriously? It's "100% compatible", despite requiring a "workaround"
in some cases, and not working on "old systems"? That's the oddest
definition of compatibility I've ever heard.
>> If he wants to produce a FAT variant, it's on him
>> to demonstrate that it actually works on the many hundreds
>> of implementations that *can* mount FAT volumes, if he
>> actually wants to call it "FAT". Of course that's
>> impossible to do, which is why following the rules is
>> pretty much required.
>
>All the rules are followed.
>The "inconvenience" is because the host OS won't overwrite
>deleted directory entries (saving them for un-delete). The
>simple system doesn't care about this (it's only reading an
>ini file and/or writing a log file, etc). The restricted
>size of the FAT12 root directory was no problem.
>In most of the use cases a small binary will be
>changed/updated by the assembler/compiler and written to the
>flash drive/image which won't entail creating a new
>directory entry. It's a simple a matter for my scripted
>system to always begin with a fresh image, mount it and write
>all the original files along with the new one always keeping
>the root directory contents within the 14 sectors. The
>limited size was no problem for such FAT12 root directory
>restricted small systems. The idea is to replace that "old"
>FAT12 system with an "old" but newer FAT32 system.
Are you saying that you're going to write this image, including the
format from your device, and never allow write* access to the volume
from anything else with any guarantee that your device will be able to
use the volume after that? OK, in that case I'll conceed that your
approach (of having a fixed root directory, but not the artificially
inflated number of sectors), should work. But if that's the actual
restriction, you should probably make that clearer, and you're still
going to leave everyone wondering why. One way you might justify this
is if the device reformatted the volume every time it mounted it (IOW,
this is an output-only volume).
OTOH, that does *not* appear to be what you're saying, and you appear
to be inplying that a new executable might be loaded onto the volume
by a PC or something. Except that you may be using a custom
utility/process to load the volume. Which again would imply a
certatin lack of compatibility.
OTOH, how much work are you saving yourself here? Just do it right.
*Or at least no write access that allows the modification of the root
directory, including any sort of re-org or file creation/deletion
operation.
>"Certain restrictions may apply".
Because it's "100% compatible"?!
>For example the simple FAT12 system "assume" that there was
>only one reserved sector (the boot sector) and conveniently
>hard coded the locations of the FAT table and root directory.
>They could do this since the image that they were
>distributed on was formatted as such and there was no
>intention to use the system otherwise. Also the size of the
>tables was fixed by the floppy disk image. So even in these
>cases what they called "FAT12" was only a small subset of the
>the actual FAT12 world.
Certainly there have been FAT12 and FAT16 implementations that assume
one reserved sector (as has been pointed out many times, there are
vast numbers of buggy implementations out there). OTOH, a good
implementation won't. Still if the diskette is actually formatted
with exactly one reserved sector it doesn't matter. That doesn't
matter since you can't normally change the number of reserved sectors
on a volume, but you *can* change the number of entries in the root
directory.