Design Photo Storage with SHA-256 Content Deduplication and Safe Deletion

Quick Overview

Design a photo storage service that deduplicates identical uploads by their SHA-256 content hash. Cover the upload flow with server-side verification, concurrent identical uploads, deletion with reference counting and garbage collection, and the privacy risks of deduplicating across users. It tests content-addressed storage design.

Design Photo Storage with SHA-256 Content Deduplication and Safe Deletion

Company: OpenAI

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

Design a photo storage service: users upload photos from their phones and computers, browse their libraries, view photos at different sizes, and delete them. Many uploads are exact duplicates, for example the same photo uploaded twice from two devices, or the same image saved by many users, so the service should **deduplicate identical files using their SHA-256 content hash** to save storage. ```hint Content is not ownership Separate the bytes of a photo from the fact that a particular user owns a photo, and ask what each delete should remove. ``` ```hint Who computes the hash Consider what happens if the server trusts a hash that the client computed, and what happens if two clients upload the same new bytes at the same moment. ``` ### Clarifying Questions - How many users, photos per user, and uploads per day, and what is the typical photo size? - Should deduplication work only within one user's library, or across all users? - What metadata must be kept per photo (capture time, location, albums), and must edits keep the original? - What are the read patterns: thumbnails in a grid, full-size views, bulk export? - What are the privacy and deletion requirements, for example how quickly deleted photos must be gone? ### What a Strong Answer Covers - Capacity estimates for storage, upload bandwidth and read traffic - A data model that separates stored content from each user's photo records - An upload flow with hashing, verification, a duplicate check, resumable uploads, and safety under concurrent identical uploads - Deletion with reference counting or garbage collection that never loses content another user still needs - The privacy implications of deduplicating across users, and mitigations - Thumbnails, CDN delivery, storage tiers and metadata queries ### Follow-up Questions - How would you also detect near-duplicates, such as the same photo resized or recompressed? - A user requests deletion of all their data. How do you prove the content is gone when other users share the same bytes? - How would you migrate billions of stored photos to a cheaper storage tier without downtime? - How do you check that the stored bytes still match their hash years later?

Overview: Design a photo storage service that deduplicates identical uploads by their SHA-256 content hash. Cover the upload flow with server-side verification, concurrent identical uploads, deletion with reference counting and garbage collection, and the privacy risks of deduplicating across users. It tests content-addressed storage design.

|Home/System Design/OpenAI
OpenAI logo
OpenAI
Sep 20, 2026
hardSoftware EngineerOnsiteSystem Design
0
0

Design a photo storage service: users upload photos from their phones and computers, browse their libraries, view photos at different sizes, and delete them. Many uploads are exact duplicates, for example the same photo uploaded twice from two devices, or the same image saved by many users, so the service should deduplicate identical files using their SHA-256 content hash to save storage.

Clarifying Questions Guidance

  • How many users, photos per user, and uploads per day, and what is the typical photo size?
  • Should deduplication work only within one user's library, or across all users?
  • What metadata must be kept per photo (capture time, location, albums), and must edits keep the original?
  • What are the read patterns: thumbnails in a grid, full-size views, bulk export?
  • What are the privacy and deletion requirements, for example how quickly deleted photos must be gone?

What a Strong Answer Covers Guidance

  • Capacity estimates for storage, upload bandwidth and read traffic
  • A data model that separates stored content from each user's photo records
  • An upload flow with hashing, verification, a duplicate check, resumable uploads, and safety under concurrent identical uploads
  • Deletion with reference counting or garbage collection that never loses content another user still needs
  • The privacy implications of deduplicating across users, and mitigations
  • Thumbnails, CDN delivery, storage tiers and metadata queries

Follow-up Questions Guidance

  • How would you also detect near-duplicates, such as the same photo resized or recompressed?
  • A user requests deletion of all their data. How do you prove the content is gone when other users share the same bytes?
  • How would you migrate billions of stored photos to a cheaper storage tier without downtime?
  • How do you check that the stored bytes still match their hash years later?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...