Resizing EBS Volumes on AWS
Key Points:
- Increase Volume Size: You can easily increase the size of your EBS volumes. You can increase the size and, if applicable, the IOPS for provisioned IOPS volumes.
- Repartitioning: After resizing, you MUST repartition your drive to allow your EC2 instance to recognize and use the additional space.
- Optimization: After resizing, the volume may enter an optimization phase to improve performance. Your volume remains usable during this period.
- Decreasing Size: You cannot directly decrease EBS volume size. Workaround: create a smaller volume and copy the data over.
Important Considerations:
- EBS volumes undergo several states when modified: resizing, then optimizing.
- Repartitioning and potentially rebooting your EC2 instance are necessary to utilize the added space.
Markdown Table Example:
| Command |
Description |
lsblk |
Lists block devices (volumes, partitions, etc.) |
df -h |
Shows disk usage information in a human-readable format |
sudo growpart /dev/xvda 1 |
Extends the partition on the specified device |
Extras:
Do I need to restart ec2 to utilize new space after resizing?
Yes, in most cases, you'll need to restart your EC2 instance to fully utilize the new space after resizing an EBS volume. Here's why:
The Operating System's View
- When you resize the EBS volume, the network storage space increases at the disk level.
- However, your operating system (Linux, Windows, etc.) is still working with its old understanding of the partition and filesystem sizes.
- It doesn't automatically detect new, unused space hanging around.
What Restarting Does
- Repartition: The restart allows you to use tools like
growpart (Linux) to tell the operating system, "Hey, the disk is bigger! Extend the partition to use that new space."