DEV Community

Cover image for Design a distributed file system: the system design interview walkthrough
Gowtham Potureddi
Gowtham Potureddi

Posted on

Design a distributed file system: the system design interview walkthrough

Design a distributed file system: the system design interview walkthrough

The request to design a distributed file system sounds like a storage box — write a file, read it back, overwrite it. On one disk that is exactly what it is. But the interview asks you to do it for petabytes of data across thousands of commodity machines that fail every day, to serve very large files reliably, and — in the sync flavour — to keep one user's files identical across every device they own, without shipping the whole file each time. That is a durability, consistency and coordination problem, not a disk. This is one of the most common system design interview prompts because the one-line brief hides the two questions that actually decide the round: where do the bytes live and stay safe, and who remembers where everything is.

This distributed file system system design turns on two decisions. First, how you split and replicate the data — a huge file becomes fixed-size chunks, each copied several times across different machines and racks, so no single failure loses anything. Second, who holds the map — a metadata master that knows the namespace and which chunk lives on which server, and must not become either a bottleneck or a single point of failure. This walkthrough follows the path a strong candidate draws on the whiteboard — requirements, estimate, API and data model, high-level design, then the deep dives — and at each step it names the follow-up the interviewer uses to tell a memorised answer from an engineer who understands the tradeoff.

Title card for a system design interview walkthrough on designing a distributed file system, showing a large file split into chunks replicated across chunk servers with a central metadata master on a dark citrus-and-lavender background.

How the file storage round is actually run

A file storage round runs about 45 minutes on a shared canvas — you draw the boxes and arrows while you talk, and the interviewer interrupts. It is a favourite because the one-line problem opens onto deep water fast: the moment you write "store the file," the question becomes on which machine, how many copies, and who keeps the map — and every answer after that (replication, the master's durability, consistency on write, delta sync) compounds. Get chunking, replication and the metadata master clean and you have shown the whole system in one problem.

The interviewer rarely lets "save the bytes to a disk and read them back" stand. "A chunk server holding one of the 3 replicas dies — what happens, and how fast?" That question — durability under a design that is otherwise just a write path — is the one a copied answer can never rehearse, and the one this round is really testing.

The rounds here are modelled on how the loop runs, not scraped from any candidate's recall. What matters for prep is the shape: a blank canvas, a clock, and a follow-up after every decision you make.

The five-step framework for any HLD round

Every high-level design answer fits the same spine. Say it out loud at the start so the interviewer knows you have a plan, then walk it:

  1. Clarify requirements — functional and non-functional, and what you are explicitly not building.
  2. Estimate — file count, sizes, chunk size and replication, to justify every later choice.
  3. High-level design — the boxes and arrows: client, metadata master, chunk servers, replication, sync.
  4. Deep dive — the two or three decisions that actually decide this system.
  5. Follow-ups — bottlenecks, failure modes, and what you would change at ten times the scale.

What the debrief measures

The score is not "right or wrong design." A good HLD debrief reads on four dimensions, and every move below maps to one: problem solving (did you split files into chunks and replicate them so a dead machine loses nothing), communication (did you say why one master and 3 replicas in a sentence), technical execution (operation log plus checkpoints for the master, heartbeats and re-replication on failure, content-hash dedup for sync), and time management (did you spend your 45 minutes on replication and the master, not on the on-disk byte layout). Reading a walkthrough teaches the design; it does not teach you to deliver it on the clock while someone pushes back.

Step 1 — Requirements: what a distributed file system must do

Spend the first few minutes here. Jumping to boxes before you have scoped the problem is the fastest way to design the wrong system.

Type Requirement
Functional Store very large files (GBs to TBs) reliably; read, write and append to them; create, delete and list files in a namespace; replicate data so no single machine failure loses it.
Functional (optional) Sync a user's files across all their devices (the Dropbox flavour); deduplicate identical content; propagate a change to other devices quickly — call these out, then scope which you will go deep on.
Non-functional Petabyte scale across commodity machines; durability (data survives disk and node failures); high availability; high sustained read/write throughput; a clearly stated consistency model.

The sentence that earns points: "Storing the bytes is the easy part — the system is really about keeping every byte durable when machines die daily, and keeping one authoritative map of where everything lives." Say that and you have framed the entire design before drawing a box.

Step 2 — Capacity estimation (back of the envelope)

Estimation here is about proving one thing: the hard axis is durability and the metadata map, not raw disk space.

Quantity Assumption Result
Files to store 1B files, avg ~100MB ~100PB of logical data
Chunk size 64–128MB fixed chunks a 1GB file ≈ 8–16 chunks; huge files stay manageable
Replication factor 3 copies per chunk ~300PB raw to store ~100PB usable
Metadata volume ~64 bytes/chunk, billions of chunks a few GB → fits in the master's memory

Two conclusions fall out, and you should say both out loud. First, replication is the cost and the durability — you pay 3x raw storage so that losing any one (or two) machines loses no data, and a large chunk size keeps the number of chunks — and therefore the metadata — small. Second, the metadata is tiny enough to live in memory on a single master: at ~64 bytes per chunk the whole namespace and chunk map is a few gigabytes, which is why the classic design centralises it — and why the master's durability and availability become the deep dive. You have now pointed the interview at the real decisions before anyone asked.

Step 3 — API and data model

The client-facing API is small; most of the state is the namespace and the chunk map the master holds, plus the chunks on the servers.

Client / internal call Operation
create(path) / delete(path) create or remove a file in the namespace (master only)
open(path) → chunk_handles[], locations[] master returns the chunk handles and which servers hold each replica
read(chunk_handle, offset, len) client reads directly from a chunk server, not through the master
write / append(chunk_handle, data) client pushes data to the replicas; the master is off the data path

The data model splits cleanly between the master's map and the servers' bytes:

Entity Notes
namespace path → file metadata (owner, size, permissions), held in the master's memory and persisted via an operation log.
file → chunks each file maps to an ordered list of chunk_handles (globally unique IDs), ~64–128MB each.
chunk → locations for each chunk handle, the set of chunk servers currently holding a replica — rebuilt from heartbeats, not the source of truth.
chunk_server holds opaque chunks on local disk; reports what it has via periodic heartbeats; serves read/write data directly to clients.

Step 4 — High-level design: the read and write path

Now the boxes. The whole system splits the control plane (who holds the map) from the data plane (where the bytes flow), and that separation is the single most important idea to name:

  • Client → metadata master (control plane): to read or write, the client first asks the master for the chunk handles and the list of chunk servers holding each replica. The master answers from in-memory metadata and then gets out of the way.
  • Client ↔ chunk servers (data plane): the client reads and writes chunk data directly from the chunk servers — the large payload never flows through the master, so the master never becomes a throughput bottleneck.
  • Chunk servers + replication: each chunk is stored on 3 servers across different racks; a write is applied to all replicas before it is acknowledged, so a reader always sees a committed copy.
  • Heartbeats + re-replication: chunk servers send periodic heartbeats; when one stops, the master notices a chunk is now under-replicated and copies a surviving replica onto a fresh server to restore the replication factor.
  • Sync / notification service (Dropbox flavour): a client uploads changed chunks, deduplicated by content hash; a notification service tells the user's other devices to pull just those chunks.

Say explicitly that this is control plane and data plane, kept apart — the master is consulted once for the map and then the bulk data flows client-to-server, which is exactly why one modest master can front a petabyte-scale cluster. Naming that split unprompted is a signal the interviewer is listening for.

A distributed file system architecture diagram showing a client first asking a metadata master for chunk handles and locations, then reading and writing chunk data directly from chunk servers, each chunk replicated three times across racks, with heartbeats to the master and a sync and notification service for cross-device updates.

Deep dive: chunking, replication and durability

This is the first decision that actually decides the round. A huge file is split into fixed-size chunks (64–128MB), and each chunk is replicated to 3 chunk servers. The size and the copies are not arbitrary — each choice is a tradeoff you should be able to defend in a sentence.

Choice What it buys The tradeoff
Large chunks (64–128MB) fewer chunks → smaller metadata → the whole map fits in the master's memory; fewer client-master round trips. wasted space and hot spots for tiny files; mitigated because most target files are large.
Replication factor 3 survives the loss of any two replicas; reads can be served from the nearest or least-loaded copy. 3x raw storage cost; every write must reach all replicas.
Rack-aware placement the 3 copies sit on different racks, so a whole-rack power or switch failure cannot take all copies. slightly more cross-rack write traffic.

Consistency on write and append. A write is sent to all three replicas and is only acknowledged once every replica has it, so a subsequent read returns committed data. A common refinement (from GFS) is a primary replica that orders concurrent writes to a chunk and tells the others to apply them in the same order, which keeps the replicas consistent under concurrent appends — the operation most large-scale ingestion pipelines actually use.

Re-replication on failure. The master tracks each chunk's replica count from heartbeats. When a chunk server dies, every chunk it held drops to 2 replicas; the master schedules copies from a surviving replica onto new servers to restore 3. Because chunks are spread across many servers, the re-replication reads and writes come from many sources at once, so recovery is fast — a dead machine is repaired in parallel, not serially.

"A chunk server holding one of the 3 replicas dies — what happens, and how fast?" The master stops hearing its heartbeat, marks every chunk it held as under-replicated, and copies a surviving replica onto fresh servers; because those copies stream from many machines in parallel, the cluster is back to 3x in minutes, and no read or write is ever served from fewer than the remaining good replicas.

A distributed file system chunking and replication diagram showing a large file split into fixed-size chunks, each chunk replicated to three chunk servers on different racks, a write applied to all replicas before acknowledgement, and the metadata master re-replicating a chunk onto a fresh server in parallel when a chunk server dies.

System Design
HLD · Storage & files · 45 min
Design a distributed file system out loud, with follow-ups

Practise on Zynter →

Deep dive: the metadata master and scaling it

This is the decision most candidates under-think. Because the chunk map is tiny, the classic design keeps a single metadata master holding the whole namespace in memory — which makes reads fast and the design simple, but immediately raises the two follow-ups the interviewer always asks: is it a bottleneck, and is it a single point of failure?

Why one master, and why it is not a throughput bottleneck. The master is only on the control path — it answers "which chunks, which servers" and hands the client off. The bulk data never touches it, so a single master can front a huge cluster. It serves metadata operations from memory, so they are fast.

Durability of the namespace (not losing the map). In-memory metadata would vanish on a crash, so every mutation (create, delete, chunk allocation) is first written to an operation log that is replicated to remote machines before the operation is acknowledged. Periodically the master writes a checkpoint (a compact snapshot of the whole namespace); on restart it loads the latest checkpoint and replays only the log entries since. The checkpoint keeps recovery fast; the replicated log keeps the namespace durable.

Availability (not stalling when the master dies). A shadow / hot-standby master tails the same operation log and holds a near-current copy of the metadata; if the primary fails, monitoring promotes the standby, which already has the namespace, so the cluster keeps serving with only a brief pause.

Avoiding the master as a scaling ceiling. The chunk→location map is not stored durably — the master rebuilds it from chunk-server heartbeats at startup — which keeps the log small. If one master's memory or request rate ever becomes the ceiling, you shard the namespace across several masters (by directory subtree or path hash), each owning part of the tree.

"The metadata master is a single point of failure — how do you not lose the namespace?" Every mutation goes to a replicated operation log before it is acknowledged, with periodic checkpoints for fast recovery; a hot-standby master tails that log and is promoted on failure. The map of chunk locations is never the source of truth — it is rebuilt from heartbeats — so the only thing you must protect is the namespace log.

System Design
HLD · Metadata & durability · 45 min
Defend a single-master namespace out loud

Practise on Zynter →

Deep dive: file sync and deduplication

Groups of a user's devices change the shape of the problem. The storage flavour (design google file system-style) is about durability inside the cluster; the sync flavour (design dropbox system design) adds the question of moving as little data as possible between a user's machines, and it is where file storage and sync system design earns its name.

The flow, end to end: a client splits each file into blocks and computes a content hash for every block. On upload it asks the server which block hashes it has not already seen and uploads only those — so identical blocks, whether within one file or across users, are stored once (block-level deduplication). The metadata records the ordered list of block hashes that reconstruct the file. A notification service then tells the user's other devices that the file changed; each device pulls only the new blocks and reassembles the file locally.

Concern Naive Scaled
Upload re-upload the whole file on every save content-hash each block; upload only blocks the server has not seen (dedup).
Edit of a large file ship the entire file again delta sync — only the changed blocks move, so a one-line edit in a 2GB file sends a few MB, not 2GB.
Two devices edit offline last writer silently wins detect the conflict on sync and keep both as versions (a "conflicted copy"), never dropping data.

Repeat the real win: throughput and bandwidth come from moving only changed, deduplicated blocks — content-hash chunking plus delta sync — so the sync system lives or dies on how little it sends, not on how fast it can push a whole file.

"A user edits one line of a 2GB file — how little data can you send to sync it?" Only the blocks that actually changed. The file is split into content-hashed blocks; the edit changes one block (or a few), the client uploads just those, and the notification service tells the other devices to pull only those block hashes — a few MB over the wire, not 2GB.

A distributed file system sync and deduplication diagram showing a file split into content-hashed blocks, only changed blocks uploaded after a server checks which hashes it already has, a notification service pushing the change to other devices that pull only the new blocks, and a conflicted-copy path when two devices edit offline.

The follow-ups that decide the file storage round

Scan the probes from each deep dive and they rhyme. Master these five and you are ready for a version of the question that is not drawn exactly like this one.

  • "A chunk server with one of 3 replicas dies — what happens, how fast?" → Heartbeat stops, chunk goes under-replicated, master copies a surviving replica onto fresh servers in parallel; no read served from fewer than the good replicas. (technical execution)
  • "The master is a single point of failure — how do you not lose the namespace?" → Replicated operation log before every ack, periodic checkpoints, a hot-standby master promoted on failure; chunk locations rebuilt from heartbeats. (problem solving)
  • "Edit one line of a 2GB file — how little can you send?" → Content-hash blocks and delta sync; only the changed blocks move, a few MB not 2GB. (communication)
  • "Why 64MB chunks and 3 replicas, not more or fewer?" → Big chunks shrink metadata so it fits in memory; 3 replicas survive two failures at 3x cost; rack-aware placement survives a rack loss. (technical execution)
  • "Is one master a bottleneck?" → No for data (it is off the data path), and if metadata load grows you shard the namespace across masters by subtree or path hash. (problem solving)

Each maps to a debrief dimension. Reading this list teaches you the answers; it does not teach you to deliver them while someone interrupts — that only comes from saying them out loud.

How to prepare: a one-week plan

You do not need fifty systems. You need this one cold and the framework automatic, so the next "design X" is just new nouns in the same five steps.

  • Days 1–2: Learn the five-step framework until it is reflex. Do the file system end to end on paper — requirements, estimate, data model, the client → master → chunk-servers read/write path.
  • Days 3–4: Drill the replication deep dive: fixed-size chunks, 3 replicas, rack-aware placement, write-to-all-replicas, and re-replication on a dead server. Say each tradeoff in one sentence.
  • Days 5–6: Own the master and sync — operation log plus checkpoints, hot standby, namespace sharding; then content-hash dedup and delta sync. Answer each of the five follow-ups out loud.
  • Day 7: A full timed 45-minute round, narrating the whole way, with someone (or something) interrupting. This is the rep that counts.

This post is the deep walkthrough behind one row of the broader Top 25 system design interview questions — once the file system is automatic, the same spine carries the rest of the list.

Frequently asked questions

How do I design a distributed file system step by step?

Follow the five-step HLD framework. Clarify requirements (store very large files reliably, read/write/append, replicate so no machine failure loses data, optionally sync across devices, at petabyte scale); estimate to show the hard axis is durability and the metadata map, not raw disk; define the small client API plus the namespace, file→chunks, chunk→locations and chunk-server model; draw the split between the metadata master (control plane) and chunk servers (data plane); then deep-dive the decisions that matter — chunking and replication, the metadata master's durability and availability, and file sync with deduplication. Finish on the follow-ups about a dead replica and losing the namespace.

What is the role of the metadata master in a distributed file system?

The metadata master holds the namespace (the directory tree and file metadata) and the map from each file to its chunks, in memory, so lookups are fast. A client asks the master which chunks a file has and which chunk servers hold each replica, then reads and writes the chunk data directly from those servers — the master stays off the data path, so it never becomes a throughput bottleneck. Its namespace is made durable with a replicated operation log and periodic checkpoints, and a hot-standby master is promoted if the primary fails.

How does a distributed file system keep data durable when machines fail?

It splits each file into fixed-size chunks and replicates every chunk to three chunk servers placed on different racks, so losing any two replicas — or a whole rack — loses no data. A write is applied to all replicas before it is acknowledged, so reads see committed data. The master tracks each chunk's replica count from heartbeats; when a server dies, the chunks it held drop below three replicas and the master copies survivors onto fresh servers in parallel, restoring the replication factor in minutes.

What is the difference between designing GFS and designing Dropbox?

Design google file system style focuses on durability and throughput inside a single cluster: chunking, 3x replication, a metadata master, and consistent writes and appends for large files read by backend jobs. Design dropbox system design adds cross-device sync for end users: a file is split into content-hashed blocks, only unseen blocks are uploaded (deduplication), and a notification service pushes changes so other devices pull just the new blocks (delta sync). One optimises for in-cluster reliability, the other for sending as little data as possible between a user's devices.

How does file sync send only the changed part of a large file?

The file is split into blocks, and each block gets a content hash. When you edit a 2GB file, only the block or blocks you touched change their hash; the client uploads just those blocks and the metadata records the new ordered list of block hashes. A notification service tells your other devices which blocks changed, and each device downloads only those blocks and reassembles the file locally. That is delta sync — a one-line edit moves a few megabytes, not the whole file — and content-hash deduplication also means identical blocks are stored only once.

How do I practise a system design interview out loud?

Reading a walkthrough is not the same as defending a design while someone interrupts. On Zynter, the HLD track runs live voice rounds modelled on how real system design loops run — you talk through a shared design on the canvas, and a voice interviewer pushes with the follow-ups above one at a time, then gives you a debrief on problem solving, communication, technical execution, and time management. The score is a practice signal, not a hiring decision.

Practise it on Zynter

You can read every hop. The round is won on replication and the metadata master.

Pick the File Storage and Sync round, draw the master-and-chunk-servers design on the canvas, and defend it out loud to a voice interviewer that keeps asking "what happens when a replica dies?" and "how do you not lose the namespace?" — then read the debrief. Zynter.ai is on-demand mock interviews modelled on real company loops, with 150+ rounds across 20 companies including the HLD system design track (Sep 2026).

Practise the File Storage round →
Browse all interview tracks

Top comments (0)