When creating an EC2 instance on AWS, you are given the option to select the size of your storage. However you may run into a scenario where you need more storage than what you have provisioned . In that case. you can either increase the size of the storage or attach an extra EBS volume to your instance . This short post is about showing how to add an extra volume to an EC2 instance.
I assume that you already know how to create a EBS volume.
Spin out your instance and attach the new volume created by following the instructions below.
- Select the new volume
- Under the "Action" tab select "attach volume"
- Select the EC2 instance you created
Under " Device name , keep /dev/sdf
(as best practice in linux, /dev/sda1 is for root volume and /dev/sd(f-p) for data volumes )Select "Attach volume"
After attaching the volume, there are few extra steps to do in order to make sure that the volume is accessible.
SSH into your EC2 and run the command below
df -f
you will only see the root volume and not the newly attached volume.
To "SEE" the newly mounted volume, run the command below
lsblk
Now you will see the newly mounted volume along with its mount point.
The next step will be to mount the new volume. Run the command below
sudo mkfs -t xfs /dev/xvdf
sudo mkdir /data
sudo mount /dev/xvdf /data
After that when we run the "df -h" command , you we should be able to see the new volume along the with the root volume
Hope you like it.
Site Web :www.asksouley.com
Twitter :@asksouley
Top comments (0)