Creating a FAT 16 formatted disk image

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
adamfc2000
Posts: 6
Joined: Thu Apr 06, 2017 2:59 pm

Creating a FAT 16 formatted disk image

Post by adamfc2000 »

Hi,

I'm looking for tools to format a disk image as a FAT 16 disk. I have tried using ImDisk to mount a blank file and then use Windows Explorer to format the disk image, but it only gives NTFS or FAT 32 as options to format.

Does anyone have any tools I could use to create a FAT 16 disk image and write files to it? I can use tools for Windows and Linux.

Many thanks,
Adam
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Creating a FAT 16 formatted disk image

Post by Brendan »

Hi,

adamfc2000 wrote:I'm looking for tools to format a disk image as a FAT 16 disk. I have tried using ImDisk to mount a blank file and then use Windows Explorer to format the disk image, but it only gives NTFS or FAT 32 as options to format.


In this case I'd assume that the disk image/file is too large.

Note that normally a set of rules are used to determine which version of FAT makes sense, where tiny volumes use FAT12, small volumes use FAT16 and everything larger uses FAT 32. I can't remember exactly what these rules are (but it'd depend on the number of sectors in some way).

For testing; I'd be tempted to try a 33 MiB volume/file - this is slightly larger than the maximum that FAT12 can support (with 8 KiB clusters) and much smaller than the maximum that FAT16 can support (e.g. 256 MiB with 4 KiB clusters).


Cheers,

Bremdan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
zaval
Member
Member
Posts: 645
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: Creating a FAT 16 formatted disk image

Post by zaval »

As Brendan says. The specification in fact tries hard to convince the reader to get that the exact type of FAT really depends not on signatures or will of volume creators but on the partition capacity. Try to read the specification and you will find about this in a very detailed way. Yes it depends on number of clusters:
FAT Type Determination
There is considerable confusion over exactly how this works, which leads to many “off by 1”, “off by 2”, “off by 10”, and “massively off” errors. It is really quite simple how this works. The FAT type—one of FAT12, FAT16, or FAT32—is determined by the count of clusters on the volume and nothing else.

...

This is the one and only way that FAT type is determined. There is no such thing as a FAT12 volume that has more than 4084 clusters. There is no such thing as a FAT16 volume that has less than 4085 clusters or more than 65,524 clusters. There is no such thing as a FAT32 volume that has less than 65,525 clusters. If you try to make a FAT volume that violates this rule, Microsoft operating systems will not handle them correctly because they will think the volume has a different type of FAT than what you think it does.

page 14 of the fatgen103 document.
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
adamfc2000
Posts: 6
Joined: Thu Apr 06, 2017 2:59 pm

Re: Creating a FAT 16 formatted disk image

Post by adamfc2000 »

The FAT type—one of FAT12, FAT16, or FAT32—is determined by the count of clusters on the volume and nothing else.


Ah, thanks. That's cleared up a few things.

In this case I'd assume that the disk image/file is too large.

Note that normally a set of rules are used to determine which version of FAT makes sense, where tiny volumes use FAT12, small volumes use FAT16 and everything larger uses FAT 32. I can't remember exactly what these rules are (but it'd depend on the number of sectors in some way).

For testing; I'd be tempted to try a 33 MiB volume/file - this is slightly larger than the maximum that FAT12 can support (with 8 KiB clusters) and much smaller than the maximum that FAT16 can support (e.g. 256 MiB with 4 KiB clusters).


Thanks - I've got things working now.
Post Reply