Skip to content

Instantly share code, notes, and snippets.

@mauricios
Last active November 8, 2019 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauricios/7c50ad84da6b9891518978235e058d15 to your computer and use it in GitHub Desktop.
Save mauricios/7c50ad84da6b9891518978235e058d15 to your computer and use it in GitHub Desktop.
Resize EBS volume

Resize AWS EBS Disk partition

The following commands are rquiered to expoand a partition and resize the file system of an EBS volume. Those steps work in EBS volumes including root volumes and can be done while they are attached to a running instance (zero downtime)

Check the size of the partition

df -H

Check partition table

lsblk

Expand partition

Skip this step if the disk has no partitions (e.g. /dev/xvdf)

sudo growpart /dev/xvda 1

Check partition table after expansion

lsblk

Resize filesystem

Use xfs_growfs for XFS partitions (common in RHEL)

sudo resize2fs /dev/xvda1

Check the size of the partition after resizing

df -H
@damaya
Copy link

damaya commented Aug 16, 2017

It works, may be in some ubuntu versions, you should skip to step on line 20, i.e sudo resize2fs /dev/xvdf

@cangulo21
Copy link

If the disk has no partitions the growpart command is not necessary. See rancher/rancher#10203

@mauricios
Copy link
Author

If the disk has no partitions the growpart command is not necessary. See [rancher/rancher#10203](rancher/rancher#102

Thanks, message added to the steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment