Design a crash-resilient file system
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Netflix's technical phone screen, last asked Dec 2025. It tests file systems, journaling and durability.
Design a file system that recovers to a consistent state, with uncorrupted file contents, after a crash at any moment (power loss, kernel panic). The interviewer expects a production-ready design discussion, not code, including where the design will bottleneck and what you would change to run it at scale.
Requirements
- Functional:
create,read,writeandappend,delete,rename; directories, file metadata (inodes) and free-space tracking. - Durability: state the guarantee, for example that data is durable once
fsync(orclose) returns, and that a crash never exposes a half-written metadata update. - Non-functional: good throughput and latency under heavy writes, bounded space overhead, operability in production (observability, upgrades, growth in capacity).
Clarifying questions
- What workload dominates: many small files, large sequential writes, or random updates?
- Must file data be crash-consistent, or only metadata (as in many journaling modes)?
- Is it a local file system on one disk, or must it span devices?
- Can we rely on the disk honouring write barriers and flush commands?
- How fast must recovery be after a crash?
What a strong answer covers
- The core consistency problem: one operation (for example
renameorappend) touches several blocks, and the disk can persist them in any order. - A chosen mechanism with trade-offs: write-ahead journaling (metadata-only versus full data journaling, ordered mode), copy-on-write trees with an atomic root swap, or log-structured layouts; why soft updates are harder.
- The on-disk layout: superblock, inode table or tree, directory structures, free-space bitmaps, journal area, with checksums on blocks.
- The recovery procedure on restart: replay committed transactions, discard incomplete ones, verify checksums; why it is fast compared with a full
fsck. - What
fsyncdoes in this design and how group commit amortizes it. - Bottlenecks named and addressed: journal write amplification, a single journal lock, fsync storms, fragmentation, and production concerns such as online upgrades and monitoring.
Follow-ups
- An application writes a new version of a config file and renames it over the old one. What guarantees does your design give, step by step?
- The disk lies about flushes. What can you still guarantee?
- How do you detect silent data corruption (bit rot)?
Where it's asked
- Netflix · Technical phone screen · Last asked Dec 202560 min · Coding, practical problem solving, or SQL and pipeline design, depending on the org
What it tests
file systems · journaling · durability · recovery
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
