Now we want to resize the volume to 1000GB, without shutting down our EC2 instance.
Go to your EC2 Management Console, Select your EC2 Instance, scroll down to the EBS Volume, click on it and click the EBS Volume ID, from there select Actions, modify and resize the disk to the needed size. As you can see the disk is now 1000GB:
1234
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 1000G 0 disk
xvda1 202:1 0 1000G 0 part /
$ sudo resize2fs /dev/xvda1
resize2fs 1.42.12 (29-Aug-2014)Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks= 7, new_desc_blocks= 63
The filesystem on /dev/xvda1 is now 262143483(4k) blocks long.
Note: If you are using XFS as your filesystem type, you will need to use xfs_growfs instead of resize2fs. (Thanks Donovan).
Example using XFS shown below:
1
$ sudo xfs_growfs /dev/xvda1
Note: If you are using nvme, it will look like this:
123456789101112131415
$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme1n1 259:0 0 160G 0 disk
-nvme1n1p1 259:1 0 80G 0 part /data
$ sudo growpart /dev/nvme1n1 1
CHANGED: partition=1start=2048 old: size=167770112end=167772160 new: size=335542239end=335544287
$ resize2fs /dev/nvme1n1p1
resize2fs 1.45.5 (07-Jan-2020)$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme1n1 259:0 0 160G 0 disk
-nvme1n1p1 259:1 0 160G 0 part /data