Skip to main content

Command Palette

Search for a command to run...

[1.8] AWS EBS Mastery: Expanding Storage and Sharing Volumes

Published
4 min read
[1.8] AWS EBS Mastery: Expanding Storage and Sharing Volumes
A

Motivated, teamwork-oriented, and responsible Data Analyst enthusiast with significant experience in increasing comprehension of reports and presentations by the average professional. Highly educated, possessing a bachelor's, and a professional certification in Google data analytics, Standard Machine learning, and statistics.

Imagine we’re renovating our home. We need to expand our kitchen (resizing EBS volumes), build a shared workspace for our family (attaching EBS to multiple instances), and choose the right appliances for each room (selecting EBS volume types). Managing Amazon EBS is just like that - balancing space, access, and performance. Let’s break down how to resize, share, and optimise our cloud storage.


1. Resizing EBS Volumes: Expanding Our Cloud "Home"

When our family grows, we might knock down a wall to add space. Similarly, resizing EBS volumes lets us expand storage for our applications.

Step 1: Modify the Volume (Knock Down the Wall)

  • AWS Console: Navigate to EC2 > Volumes, select our volume, and click Modify Volume. Increase the size or adjust IOPS/throughput.

  • Catch: We can’t shrink volumes - once expanded, there’s no going back. Think of it like adding a room; we can’t unbuild it!

Step 2: Resize the File System (Update the Floor Plan)

After expanding the volume, our OS won’t recognise the new space until we resize the file system.

For Linux:

  1. Check partitions: Use lsblk to see if our volume has partitions (like checking if our new room has doors)

  2. Expand partitions: If needed, use growpart /dev/xvda to stretch the partition.

  3. Resize the file system:

    • Ext4: sudo resize2fs /dev/xvda1.

    • XFS: sudo xfs_growfs -d /.

  4. Verify: Run df -hT to confirm the new space.

Root Volume Tip: Resizing the root volume (where our OS lives) is similar but may require stopping the instance first - like turning off the electricity before rewiring.


2. Sharing Storage: The Family Workspace

Imagine a shared home office where everyone can access the same files. EBS Multi-Attach lets up to 16 EC2 instances share a single volume - but only if they’re in the same Availability Zone.

Rules of the Shared Space

  • Volume Types: Only Provisioned IOPS SSD (io1/io2) support Multi-Attach. Think of these as premium, collaborative workspaces.

  • Cluster-Aware File Systems: Use systems like GFS2 or OCFS2 to prevent data chaos. Regular file systems (e.g., EXT4) aren’t designed for concurrent writes.

How to Set It Up

  1. Create an io2 volume: Enable Multi-Attach during creation.

  2. Attach to instances: Link the volume to multiple EC2 instances in the same AZ.

  3. Mount with care: Format the volume with a cluster-aware file system to avoid corruption.

Use Case: Perfect for high-availability databases (e.g., MySQL clusters) where multiple nodes need simultaneous access.


3. EBS Volume Types: Choosing the Right "Appliances"

Just as we’d pick a fridge for the kitchen and a blender for the bar, EBS offers volume types tailored for different workloads.

The EBS Lineup

Volume TypeAnalogyBest ForMax IOPS/Throughput
gp3 (General Purpose)All-in-one microwaveEveryday workloads (web servers)16,000 IOPS, 1,000 MB/s
io2 (Provisioned IOPS)Industrial ovenDatabases, multi-attach setups256,000 IOPS, 4,000 MB/s
st1 (Throughput HDD)Freight elevatorBig data, logs500 MB/s
sc1 (Cold HDD)Attic storageRarely accessed archives250 MB/s

Picking the Right Fit

  • Need speed? Choose io2 for transactional databases.

  • Budget-friendly? gp3 offers a balance of performance and cost.

  • Handling logs? st1 provides high throughput at lower costs.


4. Real-World Scenarios: Putting It All Together

Case 1: Scaling a Web App

  1. Resize: Start with a gp3 volume. As traffic grows, expand from 100 GB to 500 GB.

  2. Multi-Attach: Add an io2 volume for a shared database, attaching it to three EC2 instances.

  3. Optimize: Use st1 for storing user uploads and logs.

Case 2: Disaster Recovery

  • Take snapshots before resizing volumes.

  • Use Multi-Attach io2 volumes for failover clusters, ensuring minimal downtime.


Conclusion: Build a Smarter Cloud Home

Managing EBS is like mastering home renovation:

  • Resize when we need more space.

  • Share storage wisely with Multi-Attach.

  • Choose volume types that match our needs.