EBS and EFS

Learn all storage tier

and types of disk they use and same for snapshot

1. What is EBS (Elastic Block Store)?

AWS Elastic Block Store (EBS) is a durable, block-level storage service designed for use with Amazon EC2 instances. It provides persistent storage that is similar to a hard drive, allowing data to persist even after an EC2 instance is stopped or terminated. EBS volumes are attached to a single EC2 instance (except for io1/io2 multi-attach) and come in different types optimized for performance (SSD, HDD).

HDD is a traditional storage device that uses spinning disks like DVD disk, offering large capacity at a lower cost but slower performance. SSD uses flash memory with no moving parts, making it much faster, more reliable, but more expensive. Typically, HDDs are used for backups and archival, while SSDs are used for OS, databases, and high-performance workloads

💡 Example Answer: "EBS is a block storage service that provides high-performance, low-latency storage for EC2 instances. It is best suited for applications requiring consistent and high-speed disk performance, such as databases, application servers, and boot volumes."

Volume Type
Backed by
Performance
Best For

gp2/gp3

SSD

Balanced price/performance

Default for general workloads

io1/io2

SSD

High IOPS (up to millions)

Databases, transactional systems

st1

HDD

High throughput

Big data, sequential reads

sc1

HDD

Low cost

Cold data, infrequent access

Feature
SATA / Xen
NVMe / Nitro

Interface

Older (SCSI/SATA)

PCIe (direct to CPU)

Latency

Higher (milliseconds)

Ultra-low (microseconds)

IOPS

Lower

Extremely high

Queue Depth

Single queue

Thousands of parallel queues

Speed

~500 MB/s

3–6 GB/s (or more)

AWS Nitro-based instances (e.g., t3, m5, c5, r5, etc.) use NVMe for EBS and instance store devices to get:

  • Faster performance

  • Lower latency

  • Better scalability

  • Consistent naming across platforms (/dev/nvme0n1, /dev/nvme1n1, etc.)

How NVMe Is Mapped in EC2

  • Even though EBS is network storage, when attached to a Nitro instance, it’s presented as an NVMe device.

  • Example device: /dev/nvme0n1

    • Partition 1 → /dev/nvme0n1p1

  • AWS uses a software layer to map the EBS volume to NVMe protocol for higher efficiency.

EBS (Elastic Block Store) gp3, io1, io2, st1, sc1 Network-attached block storage. Independent of the instance. used for Root volume, databases, app data

once ebs modiefied we need to extend the filesystem

by

741 sudo growpart /dev/nvme0n1 1 742 df -h 743 sudo resize2fs /dev/nvme0n1p1 744 df -h

Expands the partition on the disk to occupy the newly available space.

💡 Explanation:

/dev/nvme0n1 → refers to the NVMe disk (your root volume)

1 → means “first partition” on that disk

When you increase an EBS volume’s size from, say, 20 GB → 50 GB in the AWS Console, the disk grows, but the partition inside it doesn’t automatically use that extra space.

2️⃣ sudo resize2fs /dev/nvme0n1p1 ✅ Purpose:

Expands the filesystem (ext4) inside the partition so it can actually use the new space.

💡 Explanation:

/dev/nvme0n1p1 → partition #1 (the one you just grew)

resize2fs → resizes the ext2/3/4 filesystem to match the partition’s new size.

Without this step, the partition might be bigger, but the filesystem inside it would still think it’s small.

2. What is EFS (Elastic File System)?

AWS Elastic File System (EFS) is a scalable, managed, NFS-based file storage service that can be mounted simultaneously on multiple EC2 instances. It is designed to provide high availability and automatic scaling, making it ideal for workloads that require shared access to files across multiple instances, such as web hosting, container storage, and big data applications.

💡 Example Answer: "EFS is a fully managed file storage service that allows multiple EC2 instances to access the same data simultaneously. It automatically scales as data grows and is ideal for shared file storage, web applications, and big data processing."

EBS vs. EFS - AWS Storage Comparison

Feature

EBS (Elastic Block Store)

EFS (Elastic File System)

Definition

Block storage attached to EC2 instances, similar to a virtual disk.

Managed NFS-based file storage that can be mounted across multiple instances.

Purpose

Persistent storage for a single EC2 instance.

Shared storage for multiple EC2 instances.

Access Type

Can be attached to only one EC2 instance at a time (except multi-attach for io1/io2).

Can be accessed simultaneously by multiple EC2 instances.

Use Cases

- High-performance databases (MySQL, PostgreSQL, MongoDB). - Application servers requiring persistent storage. - Boot volumes for EC2 instances.

- Shared storage for multiple EC2 instances. - Web server document root (WordPress, media hosting). - Machine learning & big data workloads.

Performance Modes

General Purpose SSD (gp3, gp2), Provisioned IOPS (io1, io2), Cold HDD (sc1), Throughput HDD (st1).

Bursting mode (default) and Provisioned Throughput mode.

Scalability

Fixed size (1 GiB – 16 TiB per volume); manual resizing required.

Auto-scales from GBs to petabytes.

Max Size per Volume/File System

16 TiB per volume.

Unlimited (up to petabytes).

Resilience

Data replicated within an AZ (availability zone).

Data replicated across multiple AZs in a region.

Multi-AZ Support

No (unless using snapshots for backups).

Yes (built-in multi-AZ replication).

Latency

Low latency, single-instance access.

Higher latency compared to EBS (network file system overhead).

Availability

Tied to a single AZ. Snapshots can be used for backup/restore.

Multi-AZ by default, ensuring higher availability.

Backup & Restore

Uses snapshots to back up data to S3.

Built-in automatic backups via AWS Backup.

Mounting

Needs to be attached to an EC2 instance like a hard drive.

Can be mounted on multiple EC2 instances using NFS.

Throughput

Up to 1,000 MiB/s (depends on volume type).

Up to 10 GiB/s throughput.

IOPS (Operations per second)

gp3: 3,000 - 16,000 IOPS, io2: Up to 256,000 IOPS.

Provisioned up to 1 GiB/s per instance.

Pricing

Pay per GB provisioned + IOPS (if applicable).

Pay per GB stored + read/write throughput.

Best When To Use

- Single EC2 instance needs fast block storage (databases, logs, VMs). - Need high IOPS for transactional workloads.

- Multiple EC2 instances need access to shared storage. - Scalability & elasticity are important.

Limitations

- Cannot be shared between multiple instances (except io1/io2 multi-attach). - Manual resizing needed.

- Higher latency than EBS. - More expensive than EBS for small workloads.

Key Differences Between EBS and EFS:

  1. EBS is block storage, while EFS is a shared file system (like an NFS mount).

  2. EBS is single-instance, while EFS supports multi-instance access.

  3. EBS must be manually resized, but EFS scales automatically.

  4. EBS has lower latency and is better for databases, while EFS is better for shared workloads (e.g., web hosting).

🔥 Quick Decision Guide:

  • Use EBS for fast, single-instance storage (databases, boot volumes, high IOPS workloads).

  • Use EFS for multi-instance shared access (web hosting, file storage, analytics).

Let me know if you need more comparisons! 🚀

Last updated