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

3 minute read
0

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

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 then reattach the volume.

Resolution

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.

Before modifying your EBS volume

1.    Review the requirements when modifying volumes to avoid failure during modification.

2.    Review the best practices for volume performance on Linux instances. This will allow the modified volume to provide the performance characteristics required for your scenario.

3.    Review how to modify your EBS volume to identify and address any potential issues before you expand your volume. For example, volumes 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 to initialize the Amazon EBS Elastic Volumes feature. This is a one-time requirement.

Warning: Stopping an instance erases the data on any instance store volumes. 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 your volume's creation date, open the Amazon EC2 console, and then choose Volumes. The Created field lists the volume's creation date.

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.

Modify the EBS volume

1.    Use Amazon EBS Elastic Volumes for EC2 instances. Request modifications to your EBS volumes to expand the EBS root volume of your EC2 Linux instance.

2.    Extend the Linux file system after you expand the EBS root volume of your EC2 Linux instance.


Related information

How do I convert my EC2 Ubuntu instance's default MBR partitioning scheme to GPT in order to bypass the 2 TiB limit for MBR partitions on my EBS volume?

Amazon EC2 instance root device volume

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago