Bobcares

Mounting EBS volume to EC2 instance

by | Dec 15, 2022

Are you wondering how to Mount EBS volume to EC2 instance? Our AWS Support team is here to lend a hand with your queries and issues.

Mounting EBS volume to EC2 instance

Mounting EBS volume to EC2 instance is an easy task with this handy guide by our experts. It involves the following steps:

  1. Create an ec2 instance
  2. Create a volume
  3. Attach volume with the instance
  4. Ssh to the instance
  5. Mount the attached volume to the “/mnt” folder of the instance

Let’s take a look at each of these steps in detail.

Create an EC2 instance

First, we have to create a Linux instance that has CentOS as the default operating system.

Create a volume

  1. First, head to the EC2 console and select Volumes under the Elastic Block Store option.
  2. Next, click the Create Volume button.
  3. Then, enter the volume size in the popup box. Furthermore, enter the same availability zone as the instance Availability Zone field.
  4. Once the volume is created, its State will change from Creating to Available.

Attach volume with the instance

  1. First, choose the new volume we created in the above section.
  2. Then, select Actions followed by Attach Volume.
  3. After that, mention the instance id of the instance which we want to attach.
  4. Finally, click Attach.

SSH to the instance

Now, we will SSH to the instance with the following command:

ssh -i “PemFile.pem” ec2-user@Instance_public_IP

Our experts would like to point out that we have to give read permission to the Pemfile.pem.

Mount the attached volume to the “/mnt” folder of the instance

In order to mount the attached volume to the “/mnt” folder of the instance, we have to enter the following commands in the order mentioned below:


lsblk
sudo mkfs -t ext4 /dev/xvdf
sudo mount /dev/xvdf /mnt
lsblk

The sudo mkfs -t ext4 /dev/xvdf command formats the xvdf volume. After that, it creates ext4 file system on it.

Then, the sudo mount /dev/xvdf /mnt mounts the xvdf to the /mnt directory.

The lbslk command lists out the available volumes as well as their Mount Point.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

To conclude, our Support Engineers demonstrated how to mount EBS volume to EC2 instance with ease.

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.