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

3 minute read
0

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

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.

Use the Amazon EBS Elastic Volumes feature to expand the EBS root volume of an EC2 Linux that runs on a current generation instance. To expand the EBS root volume of an EC2 Linux that runs on a previous generation instance, you must detach and then reattach the volume.

Before you modify your Amazon EBS volume, complete the following steps:

  1. Review the requirements for EBS volume modifications to avoid any failures.

  2. Review the best practices for volume performance on Linux instances. This allows 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, suppose that you have volumes attached to current generation instances before November 3, 2016. To initialize the Amazon EBS Elastic Volumes feature, you must either stop and restart the instance, or detach and then reattach the volume. 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, then 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 see the volume's most recent attachment time, which might be more recent than the creation time, use the AWS CLI.

The following example command lists the 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 see Modify an EBS volume if Elastic Volumes is not supported.

Modify the EBS volume

To modify the EBS volume, complete the following steps:

  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 the default MBR partitioning scheme to GPT of my EC2 Ubuntu instance so that I can bypass the 2-TiB limit for MBR partitions on my EBS volume?

Root volumes for your Amazon EC2 instances

AWS OFFICIAL
AWS OFFICIALUpdated 5 months ago