How Can You Modify an Attached EBS Volume on the Fly?
This article explains how to dynamically expand storage size, adjust IOPS performance, or change the volume type of an attached Amazon EC2 Elastic Block Store volume without experiencing downtime. You will learn the core prerequisites for using the Elastic Volumes feature, how to initiate volume modifications via the AWS Management Console and AWS CLI, how to monitor the optimization lifecycle, and how to extend the underlying Linux or Windows file system to utilize newly allocated storage capacity.
Understanding Amazon EBS Elastic Volumes
Amazon EBS Elastic Volumes allows you to dynamically increase capacity, tune performance, and change the type of live, production volumes attached to current-generation EC2 instances. Instead of stopping an instance, creating a snapshot, restoring it to a new volume, and swapping attachments, you can issue a single modification request while your application continues reading from and writing to the disk.
With Elastic Volumes, you can perform three primary modifications:
- Increase Volume Size: Expand a volume up to the
maximum allowed capacity for its type (up to \(16\text{ TiB}\) for standard SSD and HDD
volumes, or up to \(64\text{ TiB}\) for
io2Block Express). - Adjust Performance: Modify provisioned IOPS and
throughput independently on
gp3,io1, andio2volumes to match changing workload requirements. - Change Volume Type: Migrate between General Purpose
SSD (
gp2,gp3), Provisioned IOPS SSD (io1,io2), and Magnetic HDD (st1,sc1) volumes seamlessly.
Prerequisites and Limitations
Before initiating an on-the-fly modification, verify that your environment satisfies the following requirements:
- Supported Instance Types: The volume must be attached to a current-generation EC2 instance (such as Nitro-based instances or newer Xen-based families). Legacy instances may require a reboot or detachment before changes take effect.
- Increase-Only Capacity Rule: You can only increase the size of an EBS volume. Decreasing volume size is not supported; shrinking requires creating a smaller volume and migrating data manually via file-level copy Tools.
- Cooldown Period: Once you modify a volume, you must
wait at least \(6\text{ hours}\) and
ensure the volume has reached the
completedstate before applying another modification to the same volume. - Boot Volume Constraints: Throughput Optimized HDD
(
st1) and Cold HDD (sc1) cannot be used as boot volumes. Therefore, you cannot convert an active root volume intost1orsc1.
Step 1: Modify the EBS Volume
You can trigger the volume modification using either the AWS Management Console or the AWS Command Line Interface (AWS CLI).
Using the AWS Management Console
- Open the Amazon EC2 console and select Volumes under the Elastic Block Store navigation pane.
- Select the attached volume you want to update and click Actions, then Modify volume.
- Change the Volume type, Size (GiB), IOPS, or Throughput (MB/s) to your desired values.
- Click Modify, review the confirmation prompt, and click Modify again to apply the changes.
Using the AWS CLI
Use the modify-volume command to update size, IOPS,
throughput, or volume type in a single API call. For example, to convert
a volume to gp3, expand its size to \(200\text{ GiB}\), set performance to \(4000\text{ IOPS}\), and configure \(250\text{ MB/s}\) of throughput, run:
aws ec2 modify-volume \
--volume-id vol-0123456789abcdef0 \
--volume-type gp3 \
--size 200 \
--iops 4000 \
--throughput 250The command returns a VolumeModification object showing
the ModificationState as modifying.
Step 2: Monitor Modification Progress
An EBS volume modification transitions through three primary states:
modifying: The volume parameters are actively being updated. Once the state transitions out ofmodifyingintooptimizing, the new size is visible to the operating system.optimizing: The storage backend is redistributing blocks to achieve the target configuration. During this phase, volume performance stays between the source and target specifications, and is guaranteed not to drop below the source specification. Optimization can take anywhere from a few minutes to several hours depending on volume size and activity.completed: The modification is finished, and the volume operates fully at its new parameters.
To check the status of your modification via the AWS CLI, run the
describe-volumes-modifications command:
aws ec2 describe-volumes-modifications \
--volume-id vol-0123456789abcdef0Look for the ModificationState and Progress
percentage in the JSON output. As soon as the state reaches
optimizing or completed, you can proceed with
extending the OS partition and file system.
Step 3: Extend the Partition and File System
Increasing the physical block storage of an EBS volume does not automatically expand the partition or file system inside the guest operating system. You must instruct your OS to claim the newly available space.
Extending a Volume on Linux
First, connect to your Linux instance via SSH or AWS Systems Manager
Session Manager and inspect the block devices using
lsblk:
lsblkConsider the following example output for an NVMe-based instance
where the root volume (/dev/nvme0n1) was expanded to \(200\text{ GiB}\), while its first partition
(/dev/nvme0n1p1) remains at \(100\text{ GiB}\):
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 200G 0 disk
└─nvme0n1p1 259:1 0 100G 0 part /
1. Expand the Partition
If your volume uses a partition table, use the growpart
utility to extend the partition to fill the remaining space. Notice the
space between the device name and the partition number:
sudo growpart /dev/nvme0n1 1Run lsblk again to verify that nvme0n1p1
now reflects the full \(200\text{
GiB}\) size. If your volume is formatted directly as a raw block
device without a partition table, skip the growpart
command.
2. Expand the File System
Check your file system type using df -hT:
df -hTIf you are using an XFS file system (the default on
Amazon Linux 2, Amazon Linux 2023, and Red Hat Enterprise Linux), extend
the file system by targeting the mount point with
xfs_growfs:
sudo xfs_growfs -d /If you are using an ext4 file system (common on
Ubuntu and Debian), extend the file system by targeting the device or
partition name with resize2fs:
sudo resize2fs /dev/nvme0n1p1Finally, run df -h to confirm that the operating system
recognizes the expanded capacity.
Extending a Volume on Windows
If your volume is attached to a Windows Server EC2 instance, you can expand the NTFS or ReFS volume using Disk Management or PowerShell:
- Connect to your Windows instance using Remote Desktop (RDP).
- Open the Run dialog (
Win + R), typediskmgmt.msc, and press Enter to launch Disk Management. - In the menu bar, click Action and select Rescan Disks to ensure Windows detects the newly allocated space.
- Right-click the active partition adjacent to the unallocated space and select Extend Volume.
- Follow the Extend Volume Wizard, keeping the default maximum available space selected, and click Finish.
Alternatively, to extend the C: drive directly using an
elevated PowerShell prompt, run:
Update-HostStorageCache
$MaxSize = (Get-PartitionSupportedSize -DriveLetter C).SizeMax
Resize-Partition -DriveLetter C -Size $MaxSize