A complete filesystem inside a single disk image. Explore how C turns raw storage into names, directories, and persistent data.
1 GiBdisk image4 KiBper block15public APIs
01 /
Watch the bytes move
INTERACTIVE MODEL
APPLICATION LAYER01 / 09
Begin with a blank image
Formatting writes the superblock, bitmap, and FAT. The root directory owns block 265; block 266 is the first free block.
Your own little filesystem.
Create a file, write a message, then inspect its blocks. Type help for commands. Changes stay in this page until reset or reload.
userfs / consoleAPI TRACE
DIRECTORY TREEname → metadata
DISK IMAGEuserfs.img
One image, four regions. Select a region to inspect its role. Diagram not to scale.
DATA BLOCKS 265–296
DirectoryFile dataFree
1allocated data blocks
261,878free data blocks
ENTRY INSPECTORDIRECTORY
/
FAT CHAIN
A JavaScript teaching model of the C design. Commands wrap open/write/close operations; this page does not run C or create a real disk image. Lab files are limited to 64 KiB. The actual implementation and persistence tests are in the repository.
A name and its metadata live together in the parent directory. The bitmap tracks ownership. The FAT links blocks into a stream. Every operation eventually reaches an explicit byte offset in one host file.
THE PUBLIC BOUNDARY
A familiar interface, in user space.
Applications include userfs.h and link the C library. Format and mount an image, create a hierarchy, then open files for offset-based I/O. Up to 32 descriptors hold independent offsets while mounted.
Follow FAT chains for byte I/O. Seeking alone allocates nothing; later writes and truncate growth zero-fill new ranges.
Designed to make the fundamentals visible.
UserFS is a single-process library with one mounted image. It is not a kernel mount or FUSE driver. There is no journal, thread synchronization, permissions model, or hard-link support. Successful mutations flush through fsync; arbitrary power-loss recovery is outside its contract.