How do I expand the Amazon EBS root volume of my Amazon EC2 Linux instance?

Last updated: 2019-11-11

How do I use Amazon Elastic Block Store (Amazon EBS) Elastic Volumes functionality to expand the EBS root volume of my Amazon Elastic Compute Cloud (Amazon EC2) Linux instance?

Short Description

You can expand the EBS root volume of EC2 Linux running on a current generation instance without detaching and reattaching the volume by using the Amazon EBS Elastic Volumes feature. To expand the EBS root volume of EC2 Linux running on a previous generation instance, you must detach and reattach the volume.

Resolution

Before modifying your EBS volume:

1.    Review Requirements When Modifying Volumes to see requirements needed in order to avoid failure during modification.

2.    Review Amazon EBS Volume Performance on Linux Instances to be sure that the modified volume provides the performance characteristics required for your scenario.

3.    Review Requesting Modifications to Your EBS Volumes to identify and address any potential issues before you expand your volume. For example, volumes that were attached to current generation instances before November 3, 2016 require that you either stop and restart the instance or that you detach and reattach the volume in order to initialize the Amazon EBS Elastic Volumes feature. This is a one-time requirement.

Warning: When you stop an instance, the data on any instance store volumes is erased. Therefore, if you have any data on instance store volumes that you want to keep, be sure to back it up to persistent storage.

To determine when your volume was created, open the Amazon EC2 console, and then choose Volumes. The date the volume was created is listed in the Created field.

To display the volume's most recent attachment time, which might be more recent than the creation time, use the AWS Command Line Interface (AWS CLI).

The following command issues a query for volumes that were most recently attached before the cutoff date:

aws ec2 describe-volumes --region us-east-1 --query "Volumes[?Attachments[?AttachTime<=`2016-11-01`]].{ID:VolumeId}" --output text

The output is a text list of IDs for volumes that need attention:

vol-0EXAMPLE
vol-5EXAMPLE
vol-4EXAMPLE
vol-bEXAMPLE
vol-0db1c57561EXAMPLE
vol-06f90d0c16EXAMPLE

If you can't use Amazon EBS Elastic Volumes, then expand the EBS root volume of your EC2 Linux instances by completing the steps at Modifying an EBS Volume If Elastic Volumes Is Unsupported.

Modify the EBS volume:

1.    Use Amazon EBS Elastic Volumes for EC2 instances. Follow the steps at Requesting Modifications to Your EBS Volumes to expand the EBS root volume of your EC2 Linux instance.

2.    Use the methods described in Extending a Linux File System after Resizing a Volume after you expand the EBS root volume of your EC2 Linux instance.


Did this article help you?

Anything we could improve?


Need more help?