Amazon Web Services has announced –
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.
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.
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
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.
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
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.