18. FAT filesystem
Real Time Operating Systems (RTOS) •
Why Study FAT?
- Offers unique structure compared to Unix
- Still prevalent in various systems like camera file systems
File Allocation Table (FAT) Filesystem
{width=500px}
- Introduced in 1977, still relevant in 2018
- Uses linked lists for block allocation
- Utilizes FAT for metadata instead of inodes
- Despite limitations, remains widely used
- Lacks support for hard links and permissions, making it less secure
- But, it does make it suitable for single-user computers like digital cameras or USB sticks
Block Structures
{width=350px}
- Utilizes trees of “indirect” blocks
- Includes directory entries with details like…
- names
- dates
- sizes
- starting clusters
- Resembles a mix of inodes and directory entries
Linked Lists of Blocks:
{width=400px}
- Simple concept, simple implementation
- Enables arbitrary-length files but lacks random access
Some problems:
- Assume list of blocks:
{width=200px}- Accessing third block of file (cluster 6) requires iteration
- Related question:
{width=300px}- Where to store the pointers?
File Allocation Table
{width=300px}
- Neat solution to both problems:
- FAT stores “next” pointer for each cluster
- 12b, 16b, or 32b for each 2-32 kiB cluster
FAT Metadata
- Utilizes FAT instead of inodes
- Implications
- No hard links
- No permissions in FAT filesystem
- Design: (Again) suitable for single-user computers without protection mechanisms
FAT Name Lookup & Directories
- FAT Name Lookup: Root directory entry in cluster 2
- Hard-coded in FAT12 and FAT16
- Can be elsewhere in FAT32
- Directory Entries: Serialised into data blocks in the FAT filesystem
- 32 bytes
- map names to details like…
- dates
- times
- sizes
- starting cluster
- Sort of like an inode/dirent crossover