AWS

AWS | How to Mount EBS Volume

Amazon Elastic Blocks (EBS) volume provides block-level storage for EC2 virtual machines in the AWS cloud. Each EBS volume is replicated automatically in its availability zone to provide high availability and durability. So Elastic Blocks are the disk volumes that can be attached to the AWS EC2 instances. You can create and mount an EBS volume with the help of this post.

Let’s start with how to mount an EBS volume in AWS:

Mount EBS Volume in AWS

To mount an EBS volume in AWS, simply click on the “Volume” button from the left panel on the EC2 console:

Create a new volume to mount with the EC2 virtual machine by clicking on the “Create Volume” button:

Select the volume size and its type from this page:

Click on the “Create Volume” button from the end of the page:

Once the volume is created simply expand the “Action” section and click on the “Attach Volume” button:

On this page, select the instance to which you want the volume to be connected to and click on “Attach Volume”:

Then connect to the EC2 virtual machine and use the following command to check the number of volumes available:

lsblk

This command will display the list of volumes:

Then use the following command to attach the volume to the disk:

sudo fdisk -l

This command will attach the volume you just created with the disk:

Once the volume is attached to the disk, simply use the following command:

sudo mkfs.xfs /dev/xvdf

This command will create a file system type required to mount the volume:

Once the volume is attached to the disk and the file system is created, use the following command to mount the EBS volume:

sudo mount /dev/xvdf /mnt

This command will mount the volume on the disk and then use the following command to fetch the list of mounted volumes:

df -h

This command will fetch the list of mounted volumes:

You have successfully mounted an EBS Volume on disk:

Conclusion

To mount an EBS volume, simply create a new volume from the EC2 page and attach it to the EC2 virtual machine. Then connect to the EC2 virtual machine and use simple commands to create a file system required to mount the volume to the disk. This post has discussed the process of mounting the EBS Volume on the disk in AWS.

About the author

Abdul Mannan

I am curious about technology and writing and exploring it is my passion. I am interested in learning new skills and improving my knowledge and I hold a bachelor's degree in computer science.