MongoDB

Designing a File Storage System

Design a distributed file storage system like Google Drive or Dropbox — covering chunking, deduplication, sync, and metadata management.

S

srikanthtelkalapally888@gmail.com

Designing a File Storage System

A cloud file storage system lets users store, sync, and share files across devices.

Requirements

  • Upload/download files up to 5GB
  • Sync across devices
  • File versioning
  • Sharing and permissions
  • 500M users, 1 exabyte storage

File Upload Flow

1. Client splits file into 4MB chunks
2. Upload each chunk to Block Server
3. Block Server stores in S3
4. Metadata Service records chunk list

Chunking Benefits

  • Resume interrupted uploads
  • Only sync changed chunks
  • Parallel uploads (faster)

Deduplication

Hash each chunk (SHA-256). If hash exists in store, don't re-upload.

hash(chunk) → Already exists? Skip upload

Saves ~30% storage on average.

Delta Sync

Only sync chunks that changed:

File v1: [chunk1, chunk2, chunk3]
File v2: [chunk1, chunk2_new, chunk3]
→ Only upload chunk2_new

Metadata Service

files table: (file_id, user_id, name, size, chunks[])
versions table: (file_id, version, chunks[], timestamp)
users table: (user_id, quota_used, quota_limit)

Sync Protocol

  1. Client sends local state (file hashes)
  2. Server diffs with stored state
  3. Returns list of changes
  4. Client downloads/uploads changes

Conclusion

Chunking + deduplication + delta sync are the three core optimizations that make Dropbox-style storage efficient at scale.

Share this article