Solved Cluster size limit in newfs_msdos(8)

FAT32:
Maximum cluster size for FAT32 is 256K.

Windows:
Microsoft documentation and related blogs are all over the places. They generally state that max is 64K -- they rarely mentioned 256K.
I've read somewhere clusters larger than 64K in Windows may cause problem for calculating space (in some programs).
But you can have 256K cluster: FORMAT /A:256K. That's OK.

BSDs:
newfs_msdos(8) in all three BSDSs i.e. FreeBSD, OpenBSD and NetBSD has a limit of 32768 (32K) for -S sector-size option.

Question:
Why newfs_msdos(8) is limited to 32K maximum cluster size?

Footnote:
Of course we're talking about 0x0C FAT32/LBA (BIOS INT 13h extensions) aka FAT32L, not 0x0B
 
I've searched PRs and lists. The only thing, which I could find -- It's irrelevant, by the way!

From release/2.2.8 to release/10.2.0:
C:
#define    MAXCLS32  0xffffff5U    /* maximum FAT32 clusters */

Since release/10.3.0, Revision 264889 | head and then Revision 289367 | MFC
C:
#define MAXCLS32  0xffffff4U    /* maximum FAT32 clusters */

Partial Log Message:
This is required for interoperability with other FAT implementations, and in particular UEFI.

Still I couldn't find out why maximum cluseer size for FAT32 is limited to 32K, but not to 64K or 256K.
I suppose, this is what it is. Therefore I'll mark the thread as "solved".
 
32K is generally the safest option for wide compatibility. It is the maximum limit of the original FAT32 implementations (in MS-DOS 7.1 and Windows 95) and allows FAT32 volumes up to 2TiB. It's likely that many random devices don't know how to handle cluster sizes larger than 32K, nor volumes larger than 2TiB.

It's not particularly novel nor hard to expand cluster sizes in FAT, but you risk a lot in compatibility across OSes and other implementations. It's also likely that if you have a need for >2TiB volumes (where >32K clusters become useful in FAT32), another option like exFAT might suit the purpose even better.
 
  • Thanks
Reactions: a6h
It's likely that many random devices don't know how to handle cluster sizes larger than 32K, nor volumes larger than 2TiB.
That makes sense. One point which I didn't mention before -- it was Windows-related; evidently, there are some [maybe old] Windows programs, having difficulty to calculate the space correctly, during the installation. I couldn't find find the reference though.Therefore, the compatibility issue seems to be the case. Thanks.
 
Back
Top