Table of Contents

Enlarge Disk

Before you begin

Linux instances

Note
The following instructions walk you through the process of extending XFS and Ext4 file systems for Linux. For information about extending a different file system, see its documentation.

Before you can extend a file system on Linux, you must extend the partition, if your volume has one.

Extend the file system of EBS volumes

Use the following procedure to extend the file system for a resized volume.

Note that device and partition naming differs for Xen instances and instances built on the Nitro System(https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html). To determine whether your instance is Xen-based or Nitro-based, use the describe-instance-types(https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instance-types.html) AWS CLI command, and for '–instance-type', specify your instance type.

aws ec2 describe-instance-types --instance-type instance_type --query "InstanceTypes[].Hypervisor"

A value of nitro indicates that your instance is Nitro-based. A value of xen indicates that your instance is Xen-based.

To extend the file system of EBS volumes

1 Connect to your instance(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-to-linux-instance.html).

2 Resize the partition, if needed. To do so:

- Check whether the volume has a partition. Use the lsblk command.

Nitro instance example In the following example output, the root volume (nvme0n1) has two partitions (nvme0n1p1 and nvme0n1p128), while the additional volume (nvme1n1) has no partitions.

sudo lsblk

Xen instance example In the following example output, the root volume (xvda) has a partition (xvda1), while the additional volume (xvdf) has no partition.

sudo lsblk

If the volume has a partition, continue the procedure from the following step (2b). If the volume has no partitions, skip steps 2b, 2c, and 2d, and continue the procedure from step 3.

Troubleshooting tip
If you do not see the volume in the command output, ensure that the volume is attached to the instance(https://docs.aws.amazon.com/ebs/latest/userguide/ebs-attaching-volume.html), and that it is formatted and mounted(https://docs.aws.amazon.com/ebs/latest/userguide/ebs-using-volumes.html#ebs-format-mount-volume).

-Check whether the partition needs to be extended. In the lsblk command output from the previous step, compare the partition size and the volume size. If the partition size is smaller than the volume size, continue to the next step. If the partition size is equal to the volume size, the partition can't be extended.