Re: FAT32 statfs(2) inode usage

From: Tomek CEDRO <tomek_at_cedro.info>
Date: Mon, 06 Mar 2023 11:56:14 UTC
On Mon, Mar 6, 2023 at 12:47 PM Stefan Esser <se@freebsd.org> wrote:
> (..)
> even if you write FAT32 in the subject, I'd want to ask whether this really
> is a FAT32 file system or rather FAT12 or FAT16?
>
> The reason I ask is that there is no limit on the number of files (reported
> as inodes) in the root directory of a FAT32 file system, but such a limit
> does exist in FAT12/FAT16 and the default value happens to be 512 in case
> of FAT16.
>
> For FAT16 the exhaustion of root directory entries could be seen as an
> issue similar to no free inodes in a Unix file system, but it would only
> prevent the creation of new files at the root directory level.
>
> It is highly unlikely that you run into that limit unless you do actually
> store lots of files in the root directory, and then hitting that limit might
> look similar to inode exhaustion on a Unix file system (freespace, but no
> new files can be created).
> (..)
> The value of pmp->pm_RootDirEnts is initialized to bytes 17 and 18 of the
> boot sector, and that is specified to hold the number of root directory
> entries for FAT12/FAT16, but the constant "0" for FAT32.
>
> If this was a standard compliant FAT32 file, f_files should already be 0.

Wow! Thank you Stefan!! This is amazingly useful information for
embedded systems.. some of them still keep files in FAT12/16 and top
level directory :-)

I usually add -F 32 -L some label parameters to newfs_msdos... but I
got once or twice into that situation that you describe with FAT12/16
:-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info