On AWS, you can increase EBS volume size, adjust performance, or change the volume type while the volume is in use. The change should guarantee zero downtime, and without any effect on the application operations.
In this example, I’ll extend the boot disk of a CentOS 7 server from 8 GB to 20 GB
Step 1: Resize boot Volume on EBS
Login to AWS console and navigate to:
EBS > Volumes > Right Click on volume name > Modify Volume
Change the size from
20 or whichever value you want to grow to, then click “Modify”
Confirm that you want to grow disk.
A successful message should look like below
Step 2: Login to the server via ssh and extend / partition
SSH into your EC2 instance and check block device current size.
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 20G 0 disk └─xvda1 202:1 0 8G 0 part /
You can see
/dev/xvda1 is still 8 GB in size. We need to resize it to 20 GB using the
Install cloud utils
On Ubuntu / Debian system, run
sudo apt install -y cloud-guest-utils
For CentOS server, run
sudo yum -y install cloud-utils-growpart
For those new to growpart, it is Linux command line tool used to extend a partition in a partition table to fill available space.
Help page can be viewed by passing
# growpart -h growpart disk partition rewrite partition table so that partition takes up all the space it can options: -h | --help print Usage and exit --fudge F if part could be resized, but change would be less than 'F' bytes, do not resize (default: 1048576) -N | --dry-run only report what would be done, show new 'sfdisk -d' -v | --verbose increase verbosity / debug -u | --update R update the the kernel partition table info after growing this requires kernel support and 'partx --update' R is one of: - 'auto' : [default] update partition if possible - 'force' : try despite sanity checks (fail on failure) - 'off' : do not attempt - 'on' : fail if sanity checks indicate no support Example: - growpart /dev/sda 1 Resize partition 1 on /dev/sda
In our case, we will run
sudo growpart /dev/xvda 1
New disk size should be
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 20G 0 disk └─xvda1 202:1 0 20G 0 part /
Step 3: Resize `/` partition to fill all space
The last step is to resize the file system to grow all the way to fill added space
ext4 file system, use
sudo resize2fs /dev/xvda1
If your filesystem is
xfs, an XFS file system may be grown while mounted using the
sudo xfs_growfs /
Both of these commands will grow the file system to the maximum size supported by the device.
Confirm new size using
# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 20G 8.2G 12G 41% /
Congratulations!, you managed to extend a mounted
/ partition without any downtime.
AWS Recommended courses:
Other disk management articles available are:
Other AWS articles available in our blog are: