DEV Community

StuartCreed
StuartCreed

Posted on

How to Increase Storage Space of an AWS instance

Links:

https://aws.amazon.com/premiumsupport/knowledge-center/extend-linux-file-system/

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html#extend-linux-volume-partition

Actions:

Use the df -h command to show the size and the percentage used by the file system.  

Use the lsblk command to show the size of the volumes.  

  1. If you need more space then find the volume for instance (look at the attachment information). Select that volume → Actions → Modify.

Then then run lsblk to see the changes in nvme0n1p1 (if you do not see any changes then restart the server). You will not yet see the changes in running df -h as you need to allocate the new space to the partition for the filesystem.

  1. If the volume has a partition containing a file system, that partition must be resized before the file system is expanded:

Use the growpart command to extend the partition. Notice that there is a space between the device name and the partition number. This will grow nvme0n1p1 to match nvme0n1p1 (where p1 stands for partition 1) in the lsblk output in Step 1.

sudo growpart /dev/nvme0n1 1

  1. Use the resize2fs command to automatically extend the size of the /dev/root file system to the full space on the volume.

sudo resize2fs /dev/root

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay