pr...@cam.ac.uk (Patrick Welche) writes:

>(https://en.wikipedia.org/wiki/File_Allocation_Table#FAT32
>suggests:
>Min. volume size   256 MiB-36 KiB (with 65525 clusters and 4 KiB sectors)

>maybe that should be a '+' sign...)

The image consists of:

- reserved sectors (e.g. boot sector, info sector)
- FAT sectors * FAT replication count
- data clusters

Minimal reserved sectors are 16kByte or 4 sectors.

A FAT32 needs 4 bytes per entry, for 65525 clusters (plus 2 reserved entries)
it needs 64 sectors.

Minimal FAT replication count is 1.

Minimal cluster size is one sector.

-> 4 + 1 * 64 + 65525 * 1 = 65593 sectors or 262372 KiB.

% newfs_msdos -F 32 -n 1 -S 4096 -b 4096 -s 65593 -C 262372k fat32image
fat32image: 65525 sectors in 65525 FAT32 clusters (4096 bytes/cluster)
MBR type: 11
bps=4096 spc=1 res=4 nft=1 mid=0xf0 spt=63 hds=255 hid=0 bsec=65593 bspf=64 
rdcl=2 infs=1 bkbs=2

% fsck_msdos -f fat32image
** fat32image
Invalid signature in fsinfo blockfix? [yn] y

% fsck_msdos -f fat32image
** fat32image
** Phase 1 - Read and Compare FATs
** Phase 2 - Check Cluster Chains
** Phase 3 - Checking Directories
** Phase 4 - Checking for Lost Files
1 files, 262096 free (65524 clusters)

One cluster (one sector) is already used by the root directory.

The 65525 cluster minimum is pretty artificial because FAT16 is
good enough for up to 65524 clusters.

More at:
https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system

-- 
-- 
                                Michael van Elst
Internet: mlel...@serpens.de
                                "A potential Snark may lurk in every tree."

Reply via email to