Master the fundamental concepts of file systems through this focused micro-challenge.
Writing FAT12 means updating directory entries, allocating FAT clusters, and preserving boot sector invariants. Cluster chains are singly linked through 12-bit entries packed two per byte triplet in the FAT.
Create file workflow:
0xFF8.. 0xFFF EOC markersFor example, a 3-cluster file might use clusters 2 → 3 → 4 with FAT entries linking forward.
Every field you pack here , the space-padded 8.3 filename, the 0xFFF end-of-chain marker , matches exactly what tools like mkfs.fat and fsck.fat validate, and what real DOS and early Windows machines wrote to floppies for two decades. Forgetting to write the FAT back to disk after updating it in memory is a classic bug that silently corrupts the whole filesystem on the next mount.
Before you call the implementation done, walk failure modes on purpose. Test empty structures, single-element edge cases, maximum concurrency, and errno paths that must not crash the program. OS code usually fails in production when happy-path tests pass but invariants break under contention or memory pressure.
Keep structures small and name fields after kernel counterparts when possible. That lets you read man pages and kernel source side by side while you work. Print observable events during development; remove noisy logs once tests pass reliably.
You will implement create, write, and close that updates FAT and directory on disk image. The task asks you to verify round-trip by re-reading with your FAT12 reader.
Implement FAT12 writer.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github