1
From experimentation with newfs_msdos, I determined that the minimum number of bytes required to create a FAT32 partition is 34089472. One byte less and the program complains:
$ newfs_msdos -F 32 -c 1 -S 512 -C 34089471 tm
newfs_msdos: 65524 clusters too few clusters for FAT32, need 65525
$ newfs_msdos -F 32 -c 1 -S 512 -C 34089472 tm
tm: 65525 sectors in 65525 FAT32 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=66581 FATsecs=512 RootCluster=2 FSInfo=1 Backup=2
My question is: how would I have calculated 34089472?
From the FAT32 Wikipedia page, I can see a few metrics:
FAT32 requirements : 1 sector on each copy of FAT for every 128 clusters
FAT32 minimum : 1 sector per cluster × 65,525 clusters = 33,548,800 bytes (32,762.5 KB)
To me, this meant that at 512 bytes per sector, 65525 clusters and (65525/128 = 512) extra sectors overhead means that it should be
(65525 + 512) * 512 = 33810944
But, that's wrong. It's actually
(65525 + 1056) * 512 = 34089472
Where does this 1056 come from?
On a related note, FAT16 behaves the same way. You actually need 2124800 bytes instead of 2091520 (from above referenced Wikipedia page) + overhead. Why?
The OP's
1056
is a count of sectors. You seem to be counting just bytes. IOW using numbers without units is dangerous! – sawdust – 2018-12-16T01:04:12.783