Bobcares

Add EBS VOLUME To Ubuntu EC2 Instance | An Easy Way

PDF Header PDF Footer

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%Copy Code
and
EBSByteBalance%Copy Code
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
    /varCopy Code
    to
    /mnt/var.volCopy Code
    using the below code.
    rsync -va /var/ /mnt/var.vol
  8. Also, change the name from
    /varCopy Code
    into
    /var.oldCopy Code
    .
    mv /var /var.old
  9. Now create a new var directory.
    mkdir /var
  10. Then bind-mount the new
    var.volCopy Code
    to the new-empty
    /varCopy Code
    directory just created.
    mount -o bind /mnt/var.vol /var
  11. Now update
    /etc/fstabCopy Code
    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 *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!