SDSystem DesignConcepts to case studies
System DesignDSA
x
0/311
Part 1: Foundations
Part 2: APIs and Communication
Part 3: Caching
Part 4: Data and Storage
  • Block Storage
  • Distributed File Systems
  • Object Storage
  • Erasure Coding
  • Storage Tiers (Hot, Warm, Cold)
  • RAID
  • Compression and Deduplication
  • File Storage (NFS)
Part 5: Architecture
Part 6: Distributed Systems
Part 7: Advanced Data Topics
Part 8: Operations and Security
Part 9: Estimation and Interview Method
Part 10: Case Studies
System Design/Data and Storage/Storage Systems

Block Storage

A raw disk in the cloud, split into fixed blocks (EBS, SAN).

⏱ 12 min readIntermediateHas visualizer
SummaryConceptReal-Life ExampleWhy?Where?How It WorksStepsKey TermsPros & ConsMistakesReal WorldRead NextInterview Q&ACheat-Sheet

01Quick Summary

Block storage is a raw disk you rent over the network. The disk is cut into equal, numbered pieces called blocks. A server attaches the disk, puts a file system on it, and uses it like a normal drive.

  • The storage knows only block numbers: "write these bytes to block 4,812". It does not know about files or folders.
  • It is fast with low delay, so it is the usual choice for databases and server boot disks.
  • A volume is normally attached to one server at a time, and it lives in one zone. Snapshots give you backups.

02Concept: What is it?

Every disk, from a laptop SSD to a huge storage array, stores data in fixed-size chunks. These chunks are blocks (often 512 bytes to 4 KB at the disk, and larger in the file system or the storage service). A block has an address, like a house number. The disk can read or write any block by its number.

Block storage means the disk is not inside your server. It sits somewhere on the network, and your server talks to it using a protocol such as iSCSI, NVMe over fabrics or Fibre Channel. Your operating system still sees a normal local disk. You format it (for example ext4 or XFS), mount it, and then use files as usual.

Where block storage sits
Your appreads and writes files, or a database engine does it
File system on the server (ext4, XFS, NTFS)files and folders become block numbers
Block device (looks like /dev/xvdf)the raw disk the operating system sees
Network and storage service (EBS, SAN)stores the blocks, keeps copies, takes snapshots
The network disk only knows blocks. The file system on the server turns files and folders into block numbers.
🧠Blocks, files and objects
Block = the raw disk (you bring the file system). File storage = a ready folder tree shared over a network (NFS). Object storage = whole items with keys, reached over HTTP. Block is the lowest level and the fastest.

03Real-Life Example

🍡The Numbered Lockers in a Gym
A gym has 1,000 identical lockers with numbers. The gym does not care what is inside. If you say "put this in locker 482", it does it, fast. You decide how to organise your things: a notebook in locker 1 lists where everything is. That notebook is the file system. The gym (the storage) only knows locker numbers. Your key works for one person at a time, so two people cannot use your lockers together. The gym also takes a photo of all your lockers each night (a snapshot).
Gym lockers
Block storage
A numbered locker
A block with an address
Putting things in a locker by number
Writing a block by its address
Your notebook that lists where things are
The file system on the volume
Your key, for one person at a time
A volume attached to one server
The photo taken each night
A snapshot
Faster door for premium members
Provisioned IOPS volumes
All lockers are in one building
A volume lives in one zone
Using a cloud block volume
βž•Create volumesize, type, zone
→↓
πŸ”ŒAttachto one server
→↓
πŸ“‚Format + mountput a file system
→↓
πŸ“ΈSnapshotbackup to the cloud

04Why Do We Need It?

⚑Low delay
Reads and writes finish in about a millisecond or less on SSD volumes. Databases need this.
🧩Works like a local disk
Any software that expects a disk works without changes. You choose the file system.
πŸ“ˆResize and tune
Grow a volume or raise its speed without rebuilding the server (limits vary by provider).
πŸ”Outlives the server
Delete the server and keep the volume. Attach it to a new server later.
πŸ“ΈEasy backups
Snapshots save the volume. They are incremental, so they cost little.
πŸ›‘οΈSafer than local disk
The service keeps copies inside its data centre, so one broken disk does not lose data.
If a program wants a fast disk and does small random reads and writes, give it block storage.

05Where Do We Use It?

πŸ—„οΈDatabases
PostgreSQL, MySQL, MongoDB and others keep their data files on block volumes.
πŸ–₯️Server boot disks
The operating system of a cloud server starts from a block volume.
πŸ“¨Message brokers
Kafka and similar tools write logs to fast disks.
🏒SANs in company data centres
A Storage Area Network gives blocks to many servers over a dedicated network.
πŸ“¦Containers and Kubernetes
Persistent volumes are often backed by block storage (for example EBS or Persistent Disk).
πŸ§ͺBuild and test machines
Fast scratch space for compilers and test data.

06Types / Parts / How It Works

How block volumes differ

KindWhat it isTypical use
General purpose SSDBalanced price and speed. Often you can set size, IOPS and throughput separately (for example EBS gp3).Most apps, small and medium databases, boot disks
Provisioned IOPS SSDYou pay for a guaranteed rate of operations and very steady latency.Busy databases that need predictable speed
Throughput-optimised HDDSpinning disks. Cheap per GB, good for long sequential reads, poor for random reads.Logs, big data scans, backups
Local instance store (NVMe)A disk inside the physical host. Very fast but it is lost if the server is stopped or fails.Caches, scratch space, replicated databases
SAN (on premises)A shared pool of disks reached over a storage network (Fibre Channel or iSCSI).Company data centres, virtual machines

Three numbers to know

NumberMeaningWhy it matters
IOPSI/O operations per second. One read or write is one operation.Many small random reads and writes (databases) hit this limit
ThroughputMegabytes moved per second.Big sequential reads and writes (analytics, backups) hit this limit
LatencyHow long one operation takes.Every database transaction waits on it
Network block volume
EBS, Persistent Disk, SAN
  • Survives server failure
  • Can be moved and snapshotted
  • A bit more delay (a network hop)
  • Tied to one zone
Local disk
Instance store, local NVMe
  • Lowest delay
  • Very high IOPS
  • Data lost if the host fails
  • You must copy data yourself
Snapshots are incremental
πŸ’½Volume100 GB used
→↓snapshot 1
πŸ“ΈSnapshot 1100 GB
→↓2 GB changed
πŸ“ΈSnapshot 2+ 2 GB
→↓1 GB changed
πŸ“ΈSnapshot 3+ 1 GB
Full first copy Only the changes
The first snapshot stores everything. Later ones store only blocks that changed.
VisualizerFrom files to blocks, IOPS, one server at a time, and snapshotsChange the file size and block size. Then change the I/O size to see which limit bites. Last, try attaching the volume to server A and then B, write blocks and take snapshots.

1. A file is cut into fixed blocks

Block size
150 KB needs 38 blocks of 4 KB. The last block is only partly used (amber), so 2 KB is wasted. Small blocks waste less. Large blocks mean fewer, bigger I/O operations.

2. Two limits decide how fast the volume is

Size of each read or write
You get
3000
I/O operations per second
Throughput
47 MiB/s
data moved per second
Held back by
IOPS limit
IOPS allows 47 MiB/s

Throughput = IOPS x size of each I/O, but never above the throughput cap. Small I/Os hit the IOPS limit first. Big I/Os hit the throughput cap first. The ranges here match common general-purpose cloud SSD volumes (for example EBS gp3: 3,000 IOPS and 125 MiB/s included, up to 16,000 IOPS and 1,000 MiB/s). Exact limits change by type and version.

3. Attach to one server, write, and take snapshots

Server AServer Bvolume is not attached
Volume: 0 of 48 blocks used. Snapshots (each row is one snapshot, coloured blocks are what it newly stored):
No snapshots yet.
Blocks used
0/48
Snapshots
0
Snapshot storage
0 blk
only changed blocks
This volume is empty and not attached. Attach it to a server first, then write, snapshot and restore.

A tiny model: 48 blocks stand for a whole disk. Real snapshots are incremental in the same way (the first one is full, later ones keep only changed blocks), and are usually saved in object storage by the cloud.

07How to Use It / Steps / Implementation

Using block storage well

  1. 1
    Pick the volume type from the workload
    Small random reads and writes need IOPS (SSD). Big sequential scans need throughput (SSD or HDD). Boot disks and light apps need little.
  2. 2
    Size for capacity and for speed
    Some volumes tie speed to size, others let you set it. Check both numbers, and check the limits of the server too, since the server can cap the volume.
  3. 3
    Keep the volume and server in the same zone
    A volume is tied to one zone. The server must be in the same zone to attach it.
  4. 4
    Format, mount and add it to fstab
    The raw disk is empty. Make a file system, mount it, and add it to the start-up file so it is back after a reboot.
  5. 5
    Snapshot on a schedule
    Automate snapshots. Quiet or flush the database first, or use a tool that gives consistent snapshots.
  6. 6
    Test the restore
    A backup that was never restored is only a hope. Practise creating a volume from a snapshot.
  7. 7
    Monitor
    Watch IOPS used, throughput, queue length and latency. A growing queue means the volume is at its limit.
πŸ’‘Need many servers to share one disk?
A normal block volume is for one server. For shared files use a network file system (NFS, EFS) or a distributed file system. For huge, shared, static files use object storage.
⚠️Do not trust a single volume
A volume is copied inside one zone only. If the zone fails, the volume is not reachable. Use snapshots copied to another region, or replicate at the database level.

08Key Terms to Know

TermMeaning in easy words
BlockA fixed-size piece of storage with an address (a block number)
VolumeOne block storage disk that you create, attach and delete
Block deviceHow the operating system sees the disk, as a raw, empty drive
File systemThe structure (ext4, XFS, NTFS) that turns files into blocks on a disk
IOPSInput/output operations per second: how many reads and writes the disk can do
ThroughputHow many MB per second the disk can move
LatencyThe time one read or write takes
Attach / detachConnect or disconnect a volume from a server
SnapshotA point-in-time backup of a volume, usually incremental
SANStorage Area Network: a dedicated network that serves blocks to servers
iSCSIA way to send disk commands over a normal IP network
Multi-attachA special mode where a volume can be attached to several servers (needs a cluster-aware file system)

09Pros, Cons and Trade-offs

βœ… Pros
  • Low and steady latency
  • High IOPS for random reads and writes
  • Works with any file system or database
  • Survives the death of a server
  • Resizable, snapshots, encryption
⚠️ Cons
  • Usually one server at a time
  • Tied to a single zone
  • You pay for the size you provision, even if empty
  • Needs formatting and care (file system, backups)
  • More expensive per GB than object storage

Trade-offs

ChoiceWe gainWe lose
Provisioned IOPS SSDFast and steady speedHigher price
HDD volumeCheapest per GBPoor for random access
Network volumeDurable, movable, snapshotsA little extra latency
Local NVMe diskBest speedData lost if the host fails
Block vs object storageBlock: speed and updates in placeBlock: higher cost, one server, limited scale
Frequent snapshotsSmall data loss windowMore cost, more to manage
Typical speed order (illustrative)local NVMe > network SSD > HDD > object storage

10Common Problems and Mistakes

Common mistakes

  1. Hitting the IOPS or throughput cap. The database is slow, but the CPU is idle. The disk is the bottleneck.
  2. Forgetting the instance limit. A fast volume on a small server can be limited by the server's own disk bandwidth.
  3. Assuming a volume is a backup. It is only copied in one zone. Take snapshots and copy them out.
  4. Inconsistent snapshots. A snapshot in the middle of a write may restore a broken database. Flush or quiesce first.
  5. Sharing one volume between servers. Two servers writing to the same normal file system will corrupt it.
  6. Using local disks for important data. The data is gone when the host is replaced.
  7. Over-provisioning. Paying for large volumes that are mostly empty.
  8. Cold restore surprise. A volume made from a snapshot can be slow at first, while blocks load in the background.

Things to watch

πŸ“‰Burst credits
Some volume types allow short bursts, then slow to a baseline when credits run out.
🌍Zone failure
No cross-zone access. Plan replicas elsewhere.
πŸ”Encryption
Turn it on. It is usually simple and costs little speed.
🧹Orphan volumes
Volumes left after a server is deleted keep costing money.

11Real-World Examples

☁️Amazon EBS
Block volumes for EC2 servers, with gp3, io2 and HDD types, and snapshots saved to S3.
πŸ”·Google Persistent Disk and Azure Managed Disks
The same idea from other clouds: network disks with snapshots.
🏒SAN arrays
Vendors such as NetApp, Dell EMC and Pure Storage serve blocks over Fibre Channel or iSCSI inside company data centres.
🐘Managed databases
Services like RDS keep database files on block storage under the hood (general idea).
πŸ“¦Kubernetes PVs
Persistent volumes are often a cloud block disk attached to the node that runs the pod.
πŸ›’οΈCeph RBD, OpenStack Cinder
Open-source ways to offer block volumes on your own hardware.
πŸ“Note
These are general ideas. Names, limits and prices change by provider and over time.
Mini case: a database server fails
πŸ–₯️DB server 1crashes
←detach
πŸ’½Volumedata is safe
←attach
πŸ–₯️DB server 2same zone
The data was on a separate volume, so the new server picks it up and carries on.

12Related Topics to Read Next

Object Storage→

The other main kind of cloud storage: whole files with a key, shared over HTTP.

Distributed File Systems→

Share one file tree across many machines.

Replication→

Copy database data across servers and zones, beyond one volume.

Relational Databases→

The main user of block storage.

Erasure Coding→

How big storage systems keep data safe with less extra space.

B-Trees and B+ Trees→

Why databases do many small random reads and writes on the disk.

13Interview Questions with Short Answers

14Quick Revision Cheat-Sheet

  • βœ”What: a raw network disk made of numbered fixed-size blocks.
  • βœ”Use for: databases, boot disks, anything that needs fast random reads and writes.
  • βœ”Limits: IOPS (small operations), throughput (MB per second) and latency.
  • βœ”Rule: one volume, one server, one zone (normal case).
  • βœ”Snapshots: incremental backups kept in durable storage. Test your restores.
  • βœ”Not for: sharing files between many servers (use file or object storage).
  • βœ”Types: SSD (general or provisioned IOPS), HDD, local NVMe (fast but not durable), SAN.
  • βœ”One line: β€œThe fast raw disk in the cloud: great for databases, tied to one server and one zone.”
← Previous
Data Archiving and TTL
Next β†’
Distributed File Systems