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:
- Create an ec2 instance
- Create a volume
- Attach volume with the instance
- Ssh to the instance
- 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
- First, head to the EC2 console and select Volumes under the Elastic Block Store option.
- Next, click the Create Volume button.
- Then, enter the volume size in the popup box. Furthermore, enter the same availability zone as the instance Availability Zone field.
- Once the volume is created, its State will change from Creating to Available.
Attach volume with the instance
- First, choose the new volume we created in the above section.
- Then, select Actions followed by Attach Volume.
- After that, mention the instance id of the instance which we want to attach.
- 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.
0 Comments