DEV Community

sourav
sourav

Posted on

Identifying EBS Volumes and Mount Points with lsblk

Managing EBS volumes effectively is crucial for AWS users, especially when multiple volumes with identical sizes are attached to an instance. Identifying which volume is mounted where can save time and avoid potential errors.

So we can use lsblk command. lsblk command is basically used to check the information of block devices connected to our system.

In this demonstration, I will show how to identify the EBS Volume ID using the lsblk command, which is a powerful command for viewing detailed information about block devices connected to a system.

First I have created one ec2 instance with t3.micro instance type and os is amazon linux 2023 and i have attached same size of EBS volumes.

Image description

I have mounted both on linux system.

Image description

Now I have to identify which EBS volume is mounted on which path.
I can use lsblk command with --output option.
Also we can mention which specific type of information we need to check of that block device.
There are several information like Name, Size, Mountpoint, File System type, UUID and so many.

In my case, I am retrieving details such as the name, file system type, device type, size, mount point, and serial number.

To obtain this information, I am using the following command:
lsblk --output NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,SERIAL

Image description

The SERIAL column represents the volume ID, which directly maps to the AWS EBS volume, making it easy to identify.

Based on the output, volume id vol0ba857296d76cd457 is mounted on /root/test
and volume id vol090411f87c15fe113 is mounted on /root/test1

and both have the same size.

Conclusion
This method is invaluable for managing EBS volumes in scenarios where volume size alone cannot differentiate between devices. Next time you need to resize, detach, or remove a specific volume, the lsblk command ensures accuracy and efficiency.

Top comments (0)