The great thing about hosting your servers in the cloud with a provider such as Amazon Web Services is that you can provision your servers for the amount of resources you need today without having to over provision for your needs tomorrow which saves you money. When the time comes to allocate additional storage to your AWS server, you can follow these simple steps to expand your elastic block storage (EBS) volume. In this quick guide, we will show you how to expand the size of your EBS volume on a Linux EC2 instance, and extend the file system if needed.
1.) Login to your AWS console, and click EC2 → Instances
3.) Under “Elastic Block Store” click on “Volumes”
4.) Make note of the device name in the “attachment information” column for the particular volume you want to expand, since the new volume with have to be attached using the same name. Also make note of the availability zone this volume resides in. In this example, the device name is /dev/xvda and it resides in US-WEST-2A
5.) Right click on the volume, and select “Create Snapshot” This process may take a few minutes.
6.) Give your snapshot a name and description.
7.) Click on “Snapshots” under the “Elastic Block Store” navigation. Here you will see the snapshot you just created.
8.) Right click on the snapshot and select “Create Volume”
9.) Enter a new size for the volume in GB that you would like to expand to. In this example, we want our disk to be 13GB total. It’s also important to make sure your disk is in the same availability zone as the original.
10.) Navigate back to “Volumes” under “elastic block store” and you should see your newly created volume listed. Right click the old volume, and select “DETACH VOLUME”
11.) Right click on the new volume, and select “attach volume”
13.) Power on your EC2 instance and confirm the larger disk is available by typing “df -h”. Once you confirm your volume has been expanded, it’s best practice to go into “volumes” under “elastic block store” and delete the old volume you took the snapshot from.
If your file system was not automatically expanded, you may have to run “resize2fs /dev/xvda1” . In Windows, the process is similar however in step 13, you would simply open disk management and extend the volume to the unallocated space.