EBS and EFS Operations
Overview
Block and file storage are the workhorses behind servers. Amazon EBS provides network-attached block volumes for a single EC2 instance (or Multi-Attach for specific io1/io2 volumes), while Amazon EFS provides a shared, elastic NFS file system accessible from thousands of Linux instances at once.
An EBS volume is like a hard drive plugged into one computer by a very long cable; EFS is like a shared network drive in an office that grows as people add documents. Operationally the questions are: is the disk fast enough, big enough, backed up, and cost-efficient?
SysOps administrators resize volumes live, change volume types without downtime, snapshot and restore, and watch the metrics that reveal saturation.
Key Concepts
- EBS volume types: gp3/gp2 (general SSD), io2/io1 (provisioned IOPS), st1 (throughput HDD), sc1 (cold HDD). gp3 baseline 3,000 IOPS / 125 MB/s independent of size.
- Elastic Volumes: increase size, change type, IOPS or throughput while in use (6-hour wait between modifications); you cannot shrink a volume.
- After growing a volume you must extend the partition and file system (growpart, resize2fs / xfs_growfs).
- Snapshots are incremental, stored in S3, regional; copy cross-Region/account; fast snapshot restore (FSR) eliminates first-read latency; Recycle Bin protects against accidental deletes.
- An EBS volume is tied to one AZ; move it by snapshot -> restore in another AZ.
- Key EBS metrics: VolumeQueueLength, VolumeReadOps/WriteOps, BurstBalance (gp2/st1/sc1), VolumeThroughputPercentage / VolumeIdleTime; instance-level EBS limits can cap performance.
- EFS performance modes: General Purpose (default) and Max I/O; throughput modes: Elastic (recommended), Provisioned, Bursting; storage classes Standard, IA, Archive with lifecycle management.
- EFS mounts via mount targets (one per AZ) over NFSv4.1 using security groups on port 2049; EFS access points enforce user/path; FSx options cover Windows, Lustre, NetApp ONTAP, OpenZFS.
Detailed Notes
EBS volume selection
| Type | Use | Max IOPS / throughput | Boot volume? |
|---|---|---|---|
| gp3 | Default, general workloads | 16,000 IOPS, 1,000 MB/s | Yes |
| gp2 | Legacy; burst credits tied to size (3 IOPS/GB) | 16,000 IOPS | Yes |
| io2 / io2 Block Express | Databases needing consistent low latency | 64,000 / 256,000 IOPS | Yes |
| st1 | Big sequential streams, logs, data warehouse | 500 MB/s | No |
| sc1 | Infrequently accessed archive | 250 MB/s | No |
Migrate gp2 -> gp3 for cheaper baseline and decoupled IOPS.
Modify a volume live
aws ec2 modify-volume --volume-id vol-0abc --size 200 --volume-type gp3 --iops 6000 --throughput 500
aws ec2 describe-volumes-modifications --volume-ids vol-0abc \
--query "VolumesModifications[].[ModificationState,Progress]"
# On the instance (Linux, XFS root on NVMe)
lsblk
sudo growpart /dev/nvme0n1 1
sudo xfs_growfs -d / # ext4: sudo resize2fs /dev/nvme0n1p1
Snapshot operations
aws ec2 create-snapshot --volume-id vol-0abc --description "pre-upgrade" \
--tag-specifications 'ResourceType=snapshot,Tags=[{Key=Env,Value=prod}]'
aws ec2 copy-snapshot --source-region us-east-1 --source-snapshot-id snap-0123 --region eu-west-1 --encrypted
aws ec2 enable-fast-snapshot-restores --availability-zones us-east-1a --source-snapshot-ids snap-0123
aws ec2 create-volume --availability-zone us-east-1b --snapshot-id snap-0123 --volume-type gp3
Use DLM or AWS Backup for scheduled snapshots, and multi-volume crash-consistent snapshots via create-snapshots for a database striped across volumes.
EBS performance troubleshooting
| Symptom | Check |
|---|---|
| High latency, queue length > 1 per 1,000 IOPS | Volume IOPS/throughput limit reached -> raise IOPS (gp3/io2) |
| gp2 slows after a while | BurstBalance exhausted; switch to gp3 or enlarge |
| st1 throughput low | Small random I/O or burst credits depleted |
| Instance bottleneck | EBS-optimised bandwidth of the instance type reached (check EBSIOBalance%, instance limits) |
| New volume from snapshot slow at first | Lazy loading; use FSR or pre-initialise with fio/dd |
| Cannot attach | Volume and instance must be in the same AZ |
EFS operations
aws efs create-file-system --performance-mode generalPurpose --throughput-mode elastic --encrypted \
--tags Key=Name,Value=shared-app
aws efs create-mount-target --file-system-id fs-0abc --subnet-id subnet-a --security-groups sg-0efs
aws efs put-lifecycle-configuration --file-system-id fs-0abc \
--lifecycle-policies TransitionToIA=AFTER_30_DAYS TransitionToPrimaryStorageClass=AFTER_1_ACCESS
# On an instance
sudo yum install -y amazon-efs-utils
sudo mount -t efs -o tls fs-0abc:/ /mnt/efs
/etc/fstab entry: fs-0abc:/ /mnt/efs efs _netdev,tls 0 0.
EFS troubleshooting
| Symptom | Cause |
|---|---|
| Mount hangs/times out | Mount target SG does not allow TCP 2049 from the client; no mount target in that AZ; DNS not resolving |
| Throughput low (Bursting mode) | Burst credits depleted (BurstCreditBalance) -> switch to Elastic/Provisioned |
| High latency for metadata-heavy workloads | Consider Max I/O (legacy) or redesign; check PercentIOLimit |
| Permission denied | POSIX permissions / access point config / IAM authorisation on file system policy |
Choosing a storage service
| Need | Service |
|---|---|
| Single-instance low-latency block | EBS |
| Shared POSIX file system for Linux | EFS |
| Windows SMB shares / AD integration | FSx for Windows |
| HPC / ML parallel file system | FSx for Lustre |
| Temporary scratch, highest IOPS | Instance store (ephemeral!) |
| Type | Baseline / max | Use |
|---|---|---|
| gp3 | 3,000 IOPS and 125 MB/s included, up to 16,000 IOPS and 1,000 MB/s, independent of size | Default general purpose |
| gp2 | 3 IOPS/GB with burst credits | Legacy; migrate to gp3 |
| io2 / io2 Block Express | Up to 64,000 / 256,000 IOPS | Latency-sensitive databases, Multi-Attach (io1/io2) |
| st1 / sc1 | Throughput-optimized / cold HDD | Big sequential workloads |
| EFS mode | Choices |
|---|---|
| Throughput | Elastic (recommended), Provisioned, Bursting |
| Performance | General Purpose or Max I/O |
| Storage classes | Standard, Infrequent Access, Archive with lifecycle policies |
aws ec2 modify-volume --volume-id vol-0abc --volume-type gp3 --iops 6000 --size 600
lsblk && sudo growpart /dev/nvme0n1 1 && sudo xfs_growfs -d /
aws ec2 create-snapshot --volume-id vol-0abc --description nightly
aws ec2 enable-ebs-encryption-by-default
Volumes can grow online but never shrink; after resizing you must extend the partition and file system. Snapshots are incremental and stored in S3; restored volumes load lazily (use Fast Snapshot Restore to avoid first-read latency). Encrypt an unencrypted volume by copying its snapshot with encryption. Instance EBS-optimized limits can cap throughput even when the volume is fast.
Real World Example
Scenario – database slows every afternoon. A reporting database on a 500 GB gp2 volume becomes sluggish after heavy queries. CloudWatch shows BurstBalance dropping to zero and VolumeQueueLength climbing. The volume's baseline is only 1,500 IOPS (3 IOPS/GB) and burst credits are exhausted.
The ops engineer runs modify-volume to convert to gp3 with 6,000 IOPS and 400 MB/s with no downtime. Latency drops, monthly cost falls slightly, and a CloudWatch alarm on queue length alerts if saturation returns. A DLM policy snapshots the volume nightly with cross-Region copy.
Architecture Diagram
- 1Each instance has its own EBS volumes in its AZ for OS and local data.
- 2EFS mount targets in each AZ give all instances a shared file system.
- 3CloudWatch monitors queue length, burst balance and throughput.
- 4Snapshots and AWS Backup protect both EBS and EFS data.
Best Practices
- ✓Use gp3 by default and tune IOPS/throughput independently; use io2 for latency-sensitive databases.
- ✓Automate snapshots with DLM/AWS Backup, tag them and copy cross-Region.
- ✓Alarm on VolumeQueueLength, BurstBalance and BurstCreditBalance.
- ✓Enable EBS encryption by default; encrypt EFS with KMS.
- ✓Use EFS lifecycle to IA and Elastic throughput for variable workloads.
Common Interview Questions
Exam Tips
SOA-C03 focus
- Resize or change type without downtime -> Elastic Volumes; shrinking is not possible.
- Volumes are AZ-scoped; snapshots are Regional.
- Shared storage across many Linux instances -> EFS; Windows file shares -> FSx for Windows.
- gp2 slow after sustained load -> burst balance exhausted -> use gp3 or more provisioned IOPS.
Finished this lesson?
0 of 46 lessons done · 0% of the course

