EBS¶
Status: AI draft, 2026-11-16. Not yet verified by me. Written from the Amazon EBS User Guide; the filesystem-grow output is real, from a loop device in a throwaway
ubuntu:24.04container standing in for an EBS volume (loop device number normalised to loop0). No AWS calls were made.
In one line¶
EBS volumes are network block devices for EC2 that live in one Availability Zone, come in types tuned for IOPS or throughput (gp3 is the default general-purpose choice), are backed up with incremental snapshots you can copy across regions, are encrypted with KMS, and can be grown online: modify the volume, then grow the partition and filesystem.
The plain idea¶
An EBS volume is a disk you plug into an instance over the network. Because it is not physically inside the server, it survives instance stops and replacements, can be detached and attached elsewhere (in the same zone), and can be snapshotted while in use. Because it travels over the network and has limits per volume and per instance, its performance is something you choose and pay for (Disks and filesystems).
How it works¶
Volume types¶
| Type | Kind | For |
|---|---|---|
| gp3 | General-purpose SSD; a baseline of 3,000 IOPS included regardless of size, with IOPS and throughput adjustable separately from size | Most workloads: boot volumes, databases of moderate load |
| gp2 | Older SSD; IOPS tied to size, with burst credits for small volumes | Legacy; usually migrate to gp3 |
| io2 / io1 | Provisioned IOPS SSD | Latency-sensitive, high-IOPS databases; Multi-Attach |
| st1 | Throughput-optimised HDD | Large sequential reads and writes: logs, data processing |
| sc1 | Cold HDD | Rarely accessed sequential data |
IOPS is operations per second (matters for small random reads and writes, such as databases); throughput is MiB per second (matters for large sequential transfers). Each volume type and each instance type has maximums; check the volume types page and the instance's EBS bandwidth before blaming the volume (Performance triage).
Snapshots¶
flowchart TD
V["Volume in ap-south-1a"] -->|"first snapshot:<br/>all used blocks"| S1["Snapshot 1"]
V -->|"later snapshots:<br/>only changed blocks"| S2["Snapshot 2 (incremental)"]
S2 -->|"copy"| R["Snapshot in another region<br/>or account (DR)"]
S2 -->|"create volume"| N["New volume, in any zone of the region"]
- Snapshots are incremental and stored by AWS outside any single zone; deleting an older snapshot keeps whatever later ones still need.
- A volume created from a snapshot loads blocks lazily on first access, so first reads are slower unless the volume is initialised or Fast Snapshot Restore is enabled.
- Snapshots are crash-consistent; for databases, use the database's own backup or flush and freeze first (Backup and disaster recovery).
- Copying snapshots to another region or account is how volumes move between them and how you protect against a regional problem; AWS Backup automates schedules and copies.
Encryption¶
Volumes and their snapshots are encrypted with a KMS key (AWS managed or customer managed); encryption by default can be turned on per region per account. An unencrypted volume is encrypted by copying a snapshot with encryption and creating a new volume (KMS, Secrets Manager and Parameter Store).
Growing a volume online¶
- Modify the volume (size, type, IOPS, throughput) while attached; it keeps working.
- If the disk has partitions, grow the partition (
growpart). - Grow the filesystem:
resize2fsfor ext4,xfs_growfsfor XFS.
The same sequence on a loop device standing in for a volume: the device grows, but the filesystem only uses the new space after step 3.
# a 1 GiB device with ext4, mounted at /data
$ df -h /data
/dev/loop0 974M 24K 907M 1% /data
# step 1: the device grows to 2 GiB (on AWS: modify-volume)
$ lsblk -no NAME,SIZE /dev/loop0
loop0 2G
$ df -h /data
/dev/loop0 974M 24K 907M 1% /data
# step 3: grow the filesystem
$ resize2fs /dev/loop0
The filesystem on /dev/loop0 is now 524288 (4k) blocks long.
$ df -h /data
/dev/loop0 2.0G 24K 1.9G 1% /data
Volumes can only grow, not shrink, and AWS limits how soon a volume can be modified again after a change (see the modification requirements page).
Multi-Attach¶
Only Provisioned IOPS volumes (io1, io2) can attach to several instances, all in the same zone. A normal filesystem such as ext4 or XFS will be corrupted if mounted read-write by several hosts; Multi-Attach needs a cluster-aware filesystem or an application that coordinates writes. For shared files, use EFS (EFS).
A concrete example¶
A PostgreSQL instance's data volume is filling up and slowing down:
- CloudWatch shows
VolumeQueueLengthhigh and read IOPS near the gp3 baseline (CloudWatch). - Modify the gp3 volume: 200 GiB to 400 GiB, IOPS 3,000 to 6,000, throughput up, all online.
- Once the modification is optimising,
growpartandxfs_growfson the instance;dfconfirms the space. - A daily snapshot policy (AWS Backup) copies to the DR region; the database's own point-in-time backups remain the primary recovery path (RDS and Aurora would remove most of this work).
Why not just...?¶
- ...keep using gp2? gp3 decouples IOPS from size and usually costs less for the same performance. Migrate with a type change, online.
- ...rely on snapshots for database backups? They are crash-consistent only. Use database-aware backups, and snapshots as a second layer.
- ...share an EBS volume between instances to share files? Without a cluster filesystem, simultaneous writers corrupt it. Use EFS or S3.
Commands to know¶
These were not run against AWS for this page.
| Command | What it does |
|---|---|
aws ec2 describe-volumes --filters Name=attachment.instance-id,Values=<id> |
Volumes attached to an instance. |
aws ec2 modify-volume --volume-id <id> --size 400 --iops 6000 --throughput 250 |
Grow and retune a gp3 volume. |
aws ec2 describe-volumes-modifications --volume-ids <id> |
Progress of a modification. |
aws ec2 create-snapshot --volume-id <id> --description "before upgrade" |
Take a snapshot. |
aws ec2 copy-snapshot --source-region ap-south-1 --source-snapshot-id <id> --region <dr-region> --encrypted |
Copy a snapshot to another region. |
lsblk, growpart /dev/nvme1n1 1, xfs_growfs /data |
On the instance: see the new size, grow partition and filesystem. |
How it breaks¶
| Symptom | Layer | Check | Likely cause |
|---|---|---|---|
Volume bigger in AWS but df unchanged |
Filesystem | lsblk vs df |
Partition or filesystem not grown yet |
| Cannot attach a volume to an instance | Zone | Volume and instance zones | They are in different zones; snapshot and recreate |
| Slow I/O, high queue length | Performance | IOPS and throughput vs limits | Volume or instance EBS limits reached; burst credits exhausted on gp2 |
| Slow first reads on a restored volume | Lazy loading | Volume age | Blocks loaded on first access |
| Corrupted filesystem with Multi-Attach | Sharing | Filesystem type | Non-cluster filesystem mounted by several hosts |
Pod stuck on volume node affinity conflict |
Kubernetes | PV zone | EBS volume pinned to a zone with no node (EBS and EFS CSI drivers) |
Interview questions¶
1. What is EBS and how is it different from instance store?
Answer
- EBS: network block storage that persists independently of the instance, in one zone, snapshottable.
- Instance store: local disks lost on stop or terminate, fast, for scratch data.
- EBS for anything you need to keep.
2. gp3 vs io2 vs st1?
Answer
- gp3: general-purpose SSD, baseline 3,000 IOPS included, IOPS and throughput tunable independently.
- io2: provisioned IOPS for demanding databases, supports Multi-Attach.
- st1: HDD for large sequential throughput, not for random I/O.
3. How do you grow a volume without downtime?
Answer
- Modify the volume online.
- Grow the partition (
growpart) if any, then the filesystem (resize2fsorxfs_growfs). - Volumes cannot shrink.
4. How do snapshots work, and how are they used for DR?
Answer
- Incremental copies of changed blocks, stored by AWS beyond one zone.
- New volumes can be created in any zone of the region; copies go to other regions or accounts.
- Crash-consistent only: use application-aware backups for databases.
5. Why can a pod's volume not follow it to another zone?
Answer
- An EBS volume exists in one zone and attaches only to instances there.
- The PV carries that zone as node affinity.
- Moving zones means snapshot and restore, or replication at the application level.
6. A database volume is slow. How do you investigate?
Answer
- CloudWatch: IOPS, throughput, queue length, burst balance (gp2).
- Compare with the volume's and the instance's EBS limits.
- On the host:
iostatfor latency and utilisation; then retune the volume or instance type.
Try it¶
- In a privileged
ubuntu:24.04container, repeat the loop-device grow above, but with XFS (mkfs.xfs,xfs_growfs) after installingxfsprogs. - Work out the IOPS a 200 GiB gp2 volume gets and compare with a gp3 volume's baseline (use the volume types page for gp2's ratio).
- Write the steps to move an unencrypted volume to an encrypted one with minimal downtime.
Zoom out¶
EBS is the block storage under EC2 and EKS persistent volumes; EFS and S3 cover shared files and objects (EFS, S3, EBS and EFS CSI drivers). Snapshots tie into backup and DR planning (Backup and disaster recovery).
Sources¶
- Amazon EBS User Guide: volume types
- Amazon EBS User Guide: General Purpose SSD volumes
- Amazon EBS User Guide: snapshots
- Amazon EBS User Guide: copy a snapshot
- Amazon EBS User Guide: encryption
- Amazon EBS User Guide: modify a volume
- Amazon EBS User Guide: requirements for volume modifications
- Amazon EBS User Guide: extend the filesystem after resizing
- Amazon EBS User Guide: Multi-Attach