Adding an EBS Volume to a running instance on AWS
If you need to add some more space to an instance running on EC2, and that instance is running the latest LTS version of UBUNTU. It is fairly easy to do.
First, create an instance in the management console of AWS and attach it to your instance. Note - you need to create the EBS in the same AZ that your instance is running. After you EBS has been attached, you need to see where AWS mounted your image on your instance. Login to your instance and check it out
As you can see from the above output, I created a new 250 GB EBS and AWS has attached it at /dev/xvdf
. Now that
it is attached, you need to format it. I recommend using ext4 file extension,
but what you use may depend on performance requirements.
Assuming you are going with ext4
, you need to report the disk using the following command:
Reformatting should only take a few minutes, depending on the size of your EBS. Once it is reformatted, you need to update
the /etc/fstab
file to tell UBUNTU about your new disk and where it is mounted.
Save fstab
and now you should be able to mount your disk successfully
Finally, confirm your new EBS is working properly.
Done