Extending a Partition (If Needed)

Your EBS volume might have a partition that contains the file system and data. Increasing the size of a volume does not increase the size of the partition. Before you extend the file system on a resized volume, check whether the volume has a partition that must be extended to the new size of the volume.

Use the lsblk command to display information about the block devices attached to your instance. If a resized volume has a partition and the partition does not reflect the new size of the volume, use the growpart command to extend the partition. For information about extending an LVM partition, see Extending a logical volume.

Example: Partitions on a Nitro-based Instance

The following example shows the volumes on a Nitro-based instance:

   lsblk
  • The root volume, /dev/nvme0n1, has a partition, /dev/nvme0n1p1. While the size of the root volume reflects the new size, 16 GB, the size of the partition reflects the original size, 8 GB, and must be extended before you can extend the file system.

  • The volume /dev/nvme1n1 has no partitions. The size of the volume reflects the new size, 30 GB.

To extend the partition on the root volume, use the following growpart command. Notice that there is a space between the device name and the partition number.

   sudo growpart /dev/nvme0n1 1sudo1

You can verify that the partition reflects the increased volume size by using the lsblk command again.

   lsblk

Example: Partitions on a T2 Instance

The following example shows the volumes on a T2 instance:

   lsblk
  • The root volume, /dev/xvda, has a partition, /dev/xvda1. While the size of the volume is 16 GB, the size of the partition is still 8 GB and must be extended.

  • The volume /dev/xvdf has a partition, /dev/xvdf1. While the size of the volume is 30G, the size of the partition is still 8 GB and must be extended.

To extend the partition on each volume, use the following growpart commands. Note that there is a space between the device name and the partition number.

   sudo growpart /dev/xvda 1sudo1sudo growpart /dev/xvdf 1sudo1

You can verify that the partitions reflect the increased volume size by using the lsblk command again.

   lsblk