Knowledge Base

EC2 Can't resize volume after increasing size

Say we want to increase boot pressure of Ubuntu from 8G as much as 16G "on-the-fly".

Step-1) login into AWS web console -> EBS -> right mouse click on the one you wish to resize -> "Modify Volume" -> change "Size" subject and click on [Modify] button

Extend Volume

modify confirmation

success

Step-2) ssh into the instance and resize the partition:

permit's listing block gadgets connected to our container:

lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  16G  0 disk
└─xvda1 202:1    0   8G  0 part /

As you could see /dev/xvda1 is still eight GiB partition on a sixteen GiB tool and there are no other walls on the volume. Let's use "growpart" to resize 8G partition up to 16G:

# install "cloud-guest-utils" if it is not installed already
apt install cloud-guest-utils

# resize partition
growpart /dev/xvda 1

Let's check the end result (you could see /dev/xvda1 is now 16G):

lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  16G  0 disk
└─xvda1 202:1    0  16G  0 part /

Step-three) resize file gadget to develop all the way to completely use new partition space

# Check before resizing ("Avail" shows 1.1G):
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  6.3G  1.1G  86% /

# resize filesystem
resize2fs /dev/xvda1

# Check after resizing ("Avail" now shows 8.7G!-):
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       16G  6.3G  8.7G  42% /

So we've zero downtime and plenty of recent area to apply.
Enjoy!

Update: Update: Use sudo xfs_growfs /dev/xvda1 as opposed to resize2fs whilst XFS filesystem.

Johnson Augustine
Cloud Architect

Please rate this article to help us improve our Knowledge Base.

0 0