From 99709e9d0d6a52b0537d2be60a40e3dbcdf63fac Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 21 Aug 2025 21:24:50 +0200 Subject: [PATCH] chore(aws/ebs): review extending volumes --- knowledge base/cloud computing/aws/ebs.md | 28 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/knowledge base/cloud computing/aws/ebs.md b/knowledge base/cloud computing/aws/ebs.md index f8db3f4..d57c18b 100644 --- a/knowledge base/cloud computing/aws/ebs.md +++ b/knowledge base/cloud computing/aws/ebs.md @@ -225,14 +225,19 @@ Make the KMS key usable again to be able to attach such EBS volumes. Refer [Modify an Amazon EBS volume using Elastic Volumes operations] and [How do I increase or decrease the size of my EBS volume?]. +If an EC2 instance uses EBS volumes, a volume's size can be increased **without** needing to detach the volume first or +restart the EC2 instance. This allows to continue using the EC2 instance while the changes take effect. + 1. Increase the volume's size: ```sh - aws ec2 modify-volume --volume-type 'gp3' --volume-id 'vol-0123456789abcdef0' --size '750' - aws ec2 describe-volumes-modifications --volume-ids 'vol-0123456789abcdef0' --output 'VolumesModifications[]' + aws ec2 modify-volume --volume-id 'vol-0123456789abcdef0' --size '512' + + # Check on the operation + aws ec2 describe-volumes-modifications --volume-ids 'vol-0123456789abcdef0' --query 'VolumesModifications[]' ``` -1. Extend the volume's partitions from inside the instance using it: +1. Extend the volume's partitions **from inside the instance using it**: ```sh lsblk @@ -240,7 +245,7 @@ Refer [Modify an Amazon EBS volume using Elastic Volumes operations] and sudo growpart '/dev/xvda' '1' # xen ``` -1. Extend the volume's file system from inside the instance using it: +1. Extend the volume's file system **from inside the instance using it**: ```sh sudo xfs_growfs -d '/' # xfs @@ -248,6 +253,14 @@ Refer [Modify an Amazon EBS volume using Elastic Volumes operations] and sudo resize2fs '/dev/xvda1' # ext4 on xen ``` +After modifying a volume, one must wait at least **six hours** and ensure that the volume is in the `in-use` or +`available` states before one can modify the same volume. + +Modifying the volume can take from a few minutes to a few hours, depending on the changes being applied, and it does +**not** always scale linearly.
+A volume of 1 TiB in size can typically take up to six hours to be modified, but it could take 24 hours or longer in +certain situations. + ### Migrate `gp2` volumes to `gp3` See also [Hands-on Guide: How to migrate from gp2 to gp3 volumes and lower AWS cost]. @@ -255,10 +268,17 @@ See also [Hands-on Guide: How to migrate from gp2 to gp3 volumes and lower AWS c It is **strongly advised** to take a snapshot of volumes before changing their type. ```sh +aws ec2 modify-volume --volume-id 'vol-0123456789abcdef0' --volume-type 'gp3' + +# Do it for all volumes that are currently of type 'gp2' aws ec2 describe-volumes --filters "Name=volume-type,Values=gp2" --query 'Volumes[].VolumeId' --output 'text' \ | xargs -pn '1' aws ec2 modify-volume --volume-type 'gp3' --volume-id ``` +If changing the volume type from `gp2` to `gp3` **without** specifying IOPS or throughput performance, EBS +automatically provisions either equivalent performance to that of the source `gp2` volume, or the baseline `gp3` +performance, whichever is higher. + ## Further readings - [Amazon Web Services]