Linux – Increase / Resize the Disk Storage in AWS EC2 EBS without reboot

From 13th Feb 2017, there is no need to reboot the EC2 instance for increasing the EBS disk storage.

Amazon Web Services has announced –

Amazon EBS Update — New Elastic Volumes Change Everything

The good news is, EBS modification process is also applicable for root volumes as well. Let’s learn how to do that.

How to increase the Linux AWS EC2 EBS storage without rebooting?

  • Login to AWS web console
  • Search for EC2 Service in the Console and click on that.

AWS EC2 Search

  • Click on the EBS on the left menu and search for the volume you wish to modify.
  • Right click on the EBS Volume and click on Resize > Modify Volume

ebs_modify_size

  • Click on “Modify” button and it will ask for confirmation.

  • Click on “Yes” Button and it will give the confirmation that volume has been modified or not.

ebs_modification_succeded

use lsblk to identify the volume information.

[surya ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  30G  0 disk
└─xvda1 202:1    0  30G  0 part /
xvdf    202:80   0  20G  0 disk /mnt
└─xvdf1 202:81   0   10G  0 part

Now you can see that xvdf has been increased to 20 GB

now use file system specific commands to increase the volume size on the server.

for Linux ext2, ext3, or ext4 file system use below commands to increase the volume

# install "cloud-guest-utils" if it is not installed
surya:~$ sudo apt install cloud-guest-utils

surya:~$ sudo growpart /dev/xvdf 1
CHANGED: disk=/dev/xvdf partition=1: start=4096 old: size=16773086,end=16777182 new: size=73396190,end=73400286

Note: growpart command used when we want to increase a partition within disk. If there is no partition within the disk then use below command to resize the disk.

resize2fs /dev/xvdf

Now run lsblk command again to confirm

[surya ~]$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  30G  0 disk
└─xvda1 202:1    0  30G  0 part /
xvdf    202:80   0  20G  0 disk /mnt
└─xvdf1 202:81   0   20G  0 part

Now run df -h to check the space

surya:~$  df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             70G  951M   69G   2% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/xvdf             20G   45M  20G   1% /mnt

This is how you can increase the size of the EBS volume without rebooting the Linux machine.

For more information please visit AWS Documentation.

Living in permanent beta mode: Learning, Improving & evolving. SPECIALTIES: Web Application Development, Digital Media, E-Commerce Solutions, SEO, CRM Solutions, Open Source Technologies, System Administration ( Linux ), VOIP Solutions, Cloud Computing, Web Security.

1 comments On Linux – Increase / Resize the Disk Storage in AWS EC2 EBS without reboot

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer