[AWS] Root volume (EBS) can now be expanded without stopping the service! ! !
This is Yamada from the Systems Department.
Amazon EBS update was announced on February 14th.
Amazon EBS Update – New Elastic Volumes Change Everything
You can now change the EBS volume type, size, and Iops from the console panel.
Up until now, expanding EBS required stopping and detaching an instance, and attaching it to another instance, which was very troublesome, but this is convenient!
From now on, you can change EBS according to the situation while running the service!
So, I decided to try things right away.
Try expanding the EBS size from the AWS console
First, select the EBS you want to expand.
This time, change the 30GiB GP2 volume to 40GiB.
For now, select ① EBS and click ② "Action"
. The status is of course in-use.
Then, the words "Modify Volume" appear in the menu! !
Click.
Various EBS change sub-windows will appear like this.
This time we will only change the size, but if you change the volume type to "IO1" you will also be able to change Iops.
When you have finished making changes, click "Modify".
Confirm will appear.
It says that it may affect performance while working, and that the OS file system should also recognize it.
Click "Yes" to start changing the settings.
This time it took about 10 minutes to complete.
Make the instance aware of the expanded volume space
Once you've made the change, it's time to make it recognized by the OS!
Check the physical disk with lsblk. It's increasing properly! !
[root@beyond ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 40G 0 disk mqxvda1 202:1 0 30G 0 part /
But the root partition is still 30GB.
Let's expand it with the growpart command.
[root@beyond ~]# growpart /dev/xvda 1 CHANGED: disk=/dev/xvda partition=1: start=4096 old: size=62910430,end=62914526 new: size=83881950,end=83886046
The file system cannot be expanded yet.
[root@beyond ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 30G 24G 5.5G 82% /devtmpfs 992M 56K 992M 1% /dev tmpfs 1002M 0 1002M 0% /dev/shm
Resize the file system using the resize2fs command.
[root@beyond ~]# resize2fs /dev/xvda1 resize2fs 1.42.12 (29-Aug-2014) Filesystem at /dev/xvda1 is mounted on /; on-line resizing required old_desc_blocks = 2, new_desc_blocks = 3 The filesystem on / dev/xvda1 is now 10485243 (4k) blocks long.
What then? It was recognized perfectly without a single reboot! ! AWS is amazing! ! !
[root@beyond ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 24G 16G 61% /devtmpfs 992M 56K 992M 1% /dev tmpfs 1002M 0 1002M 0% /dev/shm
supplement
People who get this error may have forgotten to run the growpart command when expanding the root volume.
So was I. . .
[root@beyond ~]# resize2fs /dev/xvda resize2fs 1.42.12 (29-Aug-2014) resize2fs: Device or resource busy while trying to open /dev/xvda Couldn't find valid filesystem superblock.
Conclusion
How was it? Personally, I think this EBS update is a great update that greatly increases the flexibility of initial construction and operation, and is a huge hit.
If you are too busy to keep up with AWS information, which is becoming more and more useful, you can give it your all to Beyond