0
$\begingroup$

I had been reading about File systems recently and came across the File Allocation Table in FAT systems. As per my understanding the File Allocation Table contains entries of the various files stored in the partition. This includes things starting cluster, ending cluster, file name etc (I still didn't understand exactly which all data is stored in File Allocation Table. I am aware that the information held in the table will vary with files systems.)

Some resources say that File Allocation Table is stored in the first sector of the partition. But I have also read on wikipedia that each entry made to File Allocation Table in a FAT32 system requires 32-bit or 4 bytes. Also, it said that the maximum number of files that can be stored in FAT32 system in a single folder is 65534. Thus, assuming we have 65534 files in a folder we get 65534*4= 262136 bytes ~262 kb. This means that already half of the sector is filled with File Allocation Table. Thus, I don't understand how the entire file allocation table can be accommodated just within the first sector. Unless it is continued somewhere else or stored entirely somewhere else.

$\endgroup$

1 Answer 1

2
$\begingroup$

The first five fields of the BPB (BIOS Parameter Block) in any FAT filesystem contains are following fields:

  • The first three bytes are the boot jump; this contains EB 3C 90 (the 3C may be different), which is 8086 machine code to jump over the disk format information for convenient booting.
  • The 8-byte OEM identifier.
  • A 2-byte little-endian word, which is the number of bytes per sector.
  • 1 byte meaning the number of sectors per cluster.
  • A 2-byte little endian word, which is the number of reserved sectors.

There's more, but this is all you need to know to answer the question. The File Allocation Table follows the reserved sectors, so the first FAT sector is equal to the reserved sector count.

$\endgroup$
2
  • $\begingroup$ If file allocation table is coming right after reserved sectors (after a bit of search, it shows fat12 and fat16 only have the table right after reserved sectors) then it means that there is no constraint on its size right? Is there any specific amount of space reserved just for file allocation table alone? $\endgroup$ Commented Aug 2, 2023 at 1:47
  • $\begingroup$ The FAT table size is later in the boot sector. This might help. wiki.osdev.org/FAT $\endgroup$
    – Pseudonym
    Commented Aug 2, 2023 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.