- Newest
- Most votes
- Most comments
Hello , Certainly! Here’s a concise version of the steps to increase the EBS volume size and extend the file system on your Linux instance:
Steps to Resize EBS Volume
-
Modify EBS Volume Size Sign in to AWS Management Console. Navigate to EC2 Dashboard > "Volumes". Select Volume > "Actions" > "Modify Volume". Enter New Size > "Modify" > Confirm.
-
Extend File System on the Instance Connect to EC2 Instance via SSH:
ssh -i <your-key-pair.pem> ec2-user@<your-instance-public-dns>
Verify New Volume size: => lsblk Extend File System: =>sudo resize2fs /dev/xvdf1 //for ext4 =>sudo xfs_growfs -d / //xfs
=>Verify Extended File System: df -h
Yes, you need to adjust the EBS volume size separately. The EC2 instance size only determines the compute capacity, such as processor type and architecture, number of cores and vCPUs, amount of memory, network bandwidth, and so on.
Instructions for increasing the EBS volume size are in this documentation article: https://docs.aws.amazon.com/ebs/latest/userguide/requesting-ebs-volume-modifications.html
Note also that the storage capacity of an EBS volume can only be increased. You can't decrease it later. To reduce the size, you would have to create a new EBS volume with the smaller size and copy your data at the operating system level.
You can, however, adjust the IOPS (I/O operations per second) and throughput (megabytes per second) performance settings both up and down for volume types that support configuring them, such as gp3: https://docs.aws.amazon.com/ebs/latest/userguide/general-purpose.html#gp3-ebs-volume-type
Your lsblk
output shows the root file system located in a partition, so you'll have to extend the partition first and only extend the file system with resize2fs after that. Please try this:
sudo growpart /dev/nvme0n1 1
Thanks a lot Leo. That worked out perfectly.
Relevant content
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
This is what I have now after adjusting EBS volume as suggested here. /dev/root volume still shows as 240 GB only :
=> sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT nvme0n1 259:0 0 600G 0 disk └─nvme0n1p1 259:1 0 240G 0 part / nvme2n1 259:2 0 279.4G 0 disk nvme1n1 259:3 0 279.4G 0 disk
=> sudo -hT
Filesystem Type Size Used Avail Use% Mounted on /dev/root ext4 233G 197G 37G 85% / devtmpfs devtmpfs 31G 0 31G 0% /dev tmpfs tmpfs 31G 0 31G 0% /dev/shm tmpfs tmpfs 6.2G 896K 6.2G 1% /run tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs tmpfs 31G 0 31G 0% /sys/fs/cgroup
=> sudo resize2fs /dev/root resize2fs 1.45.5 (07-Jan-2020) The filesystem is already 62914299 (4k) blocks long. Nothing to do!