On at 2024-05-19 00:37 +0100, Liam Proven via Freedos-devel wrote:
On Fri, 17 May 2024 at 17:14, tom ehlert via Freedos-devel
<freedos-devel@lists.sourceforge.net> wrote:
Below 1GB FAT16 uses 8kB clusters. From 1GB-2GB it uses 16kB ones.
(Below ½GB it uses 4kB.)
That would require FAT17.
(?)
Not at all.
64 Ki * 16 KiB = 1024 MiB. (The actual maximum amount of clusters is of
course slightly less than 64 Ki, to be exacting.) So you're off-by-one,
a "2 GB" file system cannot possibly be fully utilised with FAT16 at a
16 KiB per cluster size. Hence tom's suggestion of FAT17.
Here is the full list:
FAT12
Drive size Secs/cluster Cluster size
< 16 MB 8 4 KiB
FAT16
Drive size Secs/cluster Cluster size
< 128 MB 4 2 KiB
< 256 MB 8 4 KiB
< 512 MB 16 8 KiB
< 1 GB 32 16 KiB
< 2 GB 64 32 KiB
This supports what tom and I wrote: up to (nearly) "2 GB" you need 32
KiB per cluster.
< 4 GB 128 64 KiB (Windows NT only)
I agree with this. Enhanced DR-DOS, FreeDOS, and my MS-DOS v4 fork also
support 64 KiB per cluster now.
< 8 GB 256 128 KiB (Windows NT 4.0 only)
< 16 GB 512 256 KiB (Windows NT 4.0 only)
EDR-DOS, FreeDOS, and lMS-DOS also support 128 KiB clusters, using 256
Sectors per Cluster. For further comment see below.
FAT32
Drive size Secs/cluster Cluster size
< 260 MB 1 512 bytes
< 8 GB 8 4 KiB
< 16 GB 16 8 KiB
< 32 GB 32 16 KiB
< 2 TB 64 32 KiB
It seems that a 2 TiB file system could actually use 8 KiB per cluster
if you were willing to tolerate a FAT size of 1 GiB each. (1 GiB is the
maximum size of a FAT's usable data in FAT32.)
2 * 1024 * 1024 * 1024 * 1024 / (2 ** 28) = 8192.
Not claiming any formatting tool does this, but the numbers check out.
(If anyone is confused about 2 to the power 28, this is because FAT32
actually reserves the top 4 bits of every 32-bit FAT entry. They're
masked off by drivers and never set by anyone AFAIK. So the usable
amount of entries is 2 ** 28, not 2 ** 32.)
Source:
https://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html
Confirmation:
https://www.researchgate.net/figure/Default-cluster-size-for-FAT-compatible-OS_tbl1_261851917
To get to the "Windows NT 4.0 only" entries: I'd never heard of any MSW
supporting 256 Sectors per Cluster. Let alone 512. I didn't find any
other source that confirms this or even explains how such large SpC
values are to be encoded in the file system in order for a driver to use
them. I was also under the impression that EDR-DOS was the first
implementation of FAT FS with 256 SpC.
The only other source I found that supports the possibility of 256 KiB
clusters is in the English Wikipedia page for FAT, in the FAT16B info box:
> Max volume size
>
> 2 GB (with 32 KB clusters)
> 4 GB (with 64 KB clusters) (NT 4, PTS-DOS, EDR-DOS)
> 8 GB (with 128 KB clusters and 1 or 2 KB sectors) (NT 4 and
EDR-DOS only)
> 8 GB (with 128 KB clusters and 512 byte sectors) (EDR-DOS only)
> 16 GB (with 256 KB clusters and 2 or 4 KB sectors) (NT 4 only)
https://en.wikipedia.org/wiki/File_Allocation_Table#Final_FAT16
You will note that the "8 GB" limits listed use 512 BpS only for the
EDR-DOS 256 SpC extension, only. The other "8 GB" and the "16 GB"
specify larger sector sizes. That would explain how to get to a 256 KiB
cluster, without even the 256 SpC extension.
Regards,
ecm
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel