Simply increasing the size of the console side will not increase the size of the volume inside the server. Only EBS – Elastic Volumes feature allows you to increase volume size while the volume is still in use, making the resizing process a lot easier and faster. Let’s start to increase the disk space on Linux Server for AWS by Lia Infraservices te leaders in AWS Cloud Migration Services in Chennai, India.
Note: Before moving on with the steps to increase the disk space on the Linux server for AWS follow the 2 recommendations and check out the warning too.
Recommendations to increase the Disk Space on Linux Server
It is always recommended to have multiple partitions on the disk and mount those partitions separately, based on the server purpose
Ex: For the webserver, it is always recommended to have a separate partition and mounted at /var/www and other partition for /var/log and keep /tmp on another partition
It is to enable LVM to manage future storage demand.
But, if by any means, there is only EBS volume attached to an EC2 server and the storage gets filled and your application stopped working.
The only solution to bring the application up and running is to increase the storage.
This practice of having a single disk for the production server is not recommended.
It is not recommended to have the default partition of the single EBS volume and run an application server
Steps To increase the storage on AWS:
From AWS console or CLI – increase the EBS storage by modifying the volume.
Then – SSH to the server
Execute the command “lsblk”
You will see the disk is updated with a new size, but the partition remained on an older size.
Find the filesystem type first – cat /etc/fstab
Based on the file system, the next commands would be executed
Now, increase the partition, execute this command
sudo growpart /dev/nvme0n1 1
Note: Look for your device name from lsblk command, it can be /dev/xvda also.
Now, to resize the existing partition with the latest increment in storage, execute this command
“sudo resize2fs /dev/nvme0n1p1”
to verify, if the partition size increased, execute this command
Based on the filesystem, need to increase the size
a. sudo resize2fs /dev/xvda1 [for ext4 type of file system]
b. For XFS – sudo xfs_growfs -d / [/ — root partition]
In this article, we have shared with you how to Increase the Disk Space on Linux Server for AWS? Sometimes there could be a need to increase the disk space of your servers. It is always recommended to take a snapshot of the volume before you extend it or increase the disk size. Also, it is not advisable to decrease the disk size. Increasing the size of a volume does not increase the size of the partition, its file system must be extended.
For more information on increasing the disk space of the boot volume. Contact Lia Infraservices the Leaders in AWS Cloud Migration Services in Chennai, India.
You may also be interested to go through our other blogs on AWS Cloud Migrations:
How to connect a domain from a different domain provider to the website hosting on the AWS EC2 server?
Error Message: Failed to RDP the target VM/instance on Azure/AWS post-migration.
Case study on “AWS to Azure Cloud Migration Errors.
Feel free to comment your views in the comment box below.
Leave a Reply