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.

  • 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

  • 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.

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.

Surya

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.

View Comments

  • This seems to be for the ubuntu. How can it be done for Centos? Are there any ways to make the same issue in Cento. Thanks

Share
Published by
Surya

Recent Posts

How to get the all the database and table sizes of MySQL or MariaDB?

If you are working with MySQL or MariaDB web server, sooner or later you will…

7 years ago

How to set or change default text editor for crontab in Linux?

To edit the crontab entries you use crontab -e. The command will check for the…

7 years ago

How to install Comodo SSL certificate with NGNIX web server?

Installation method for COMODO SSL Certificate If you have generated the CSR and purchased or…

7 years ago

How to give access to specific users to specific buckets on AWS S3

In AWS S3, you might want to provide the access to selected users to selected…

7 years ago

How to add or change the password (passphrase) of OpenSSH key?

It's possible you have earlier generated a ssh key without password/ passphrase. Later you found…

7 years ago

How to find files on linux OS ( distributions )

If you are working on Linux OS, finding files effectively always a tricky part. Like…

7 years ago