Bobcares

Add EBS VOLUME To Ubuntu EC2 Instance | An Easy Way

by | Dec 5, 2022

Let’s see the steps to add EBS Volume to Ubuntu EC2 Instance. Bobcares, as a part of our AWS Support Services, offers solutions to every query that comes our way.

Adding EBS Volume to Ubuntu EC2 Instance

Amazon EBS is an easy-to-use, high-performance block storage at any scale. For a variety of apps, Amazon EBS offers a variety of volume types. It allows us to optimize storage performance and cost. These volume types can be divided into two main groups: HDD-backed storage and SSD-backed storage.

Add EBS VOLUME to Ubuntu EC2 Instance

The price for HDD-backed storage is $0.045/GB-month. And the price for SSD-backed storage is $0.125/GB-month.

What is an Amazon EBS–optimized EC2 instance?

An EBS-optimized EC2 instance uses an optimized configuration stack. It also provides additional, dedicated capacity for Amazon EBS I/O. This optimization provides the best performance for the EBS volumes by minimizing contention between Amazon EBS I/O and other traffic from the instance.

EBS-optimized instances provide Amazon EBS with dedicated bandwidth. We can use the EBSIOBalance% and EBSByteBalance% metrics to help us determine whether the instances are sized correctly.

Steps to Add EBS Volume to Ubuntu EC2 Instance

Here we need to mount /var into a new partition.

  1. Firstly create a new volume and leave the snapshot id empty.
  2. Then we must name the new volume [var-vol].
  3. Now attach the volume to an instance by right-clicking on volume/attach and choosing the EC2 instance.
  4. We must now format the instance. We can use an ssh terminal for this purpose.
    mkfs.ext4 /dev/xvdv
  5. Mount the volume to the file system.
    mkdir -m 000 /mnt/var.vol
    echo "/dev/xvdv /mnt/var.vol auto noatime 0 0" >> /etc/fstab
    mount /mnt/var.vol
  6. Then we should stop all the possible processes.
    service --status-all |grep + to see what is running
  7. Then sync /var to /mnt/var.vol using the below code.
    rsync -va /var/ /mnt/var.vol
  8. Also, change the name from /var into /var.old.
    mv /var /var.old
  9. Now create a new var directory.
    mkdir /var
  10. Then bind-mount the new var.vol to the new-empty /var directory just created.
    mount -o bind /mnt/var.vol /var
  11. Now update /etc/fstab to make bind-mount permanent.
    echo "/mnt/var.vol /var none bind" >> /etc/fstab
  12. Finally, reboot the system to apply the changes.

[Looking for a solution to another issue? We’re available 24/7.]

Conclusion

In this post, we provide the steps to add EBS VOLUME to the Ubuntu EC2 Instance, along with a detailed description of the EBS-optimized EC2 instance.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.