Extending the disk space on an EC2 instance

3 steps to extend the disk space on an EC2 instance



  1. Resize EBS Volume
  2. Resize partition
  3. Resize file system

Resize Volume

  • Login to your AWS Web console
  • Go to EBS
  • Select the volume that you want to extend
  • Click Modify Volume
  • And change the size field to whatever value you need(100 in our case)
  • And finally click the Modify button to apply the changes.

Resize partition

$ lsblk
NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1       259:0    0  18G  0 disk
├─nvme0n1p1   259:1    0   8G  0 part /
└─nvme0n1p128 259:2    0   1M  0 part

$ sudo growpart /dev/nvme0n1 1
CHANGED: partition=1 start=4096 old: size=16773087 end=16777183 new: size=37744607 end=37748703
[ec2-user@ip-172-16-0-86 ~]$ lsblk
NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1       259:0    0  18G  0 disk
├─nvme0n1p1   259:1    0  18G  0 part /
└─nvme0n1p128 259:2    0   1M  0 part

Resize Filesystem

$ sudo xfs_growfs /dev/nvme0n1p1

Comments