简体   繁体   中英

AWS EC2 EBS Volume mapping - how to identify volume on host

So in AWS, we have two EC2 EBS volumes, and they are both attached to the same EC2 instance.

If I look at the details for the volumes in AWS, I see this:

Let's call this one "Volume A":

"VolumeId": "vol-0e173xxxad8",
"Device": "/dev/sda1",
"InstanceId": "i-01a15xxx66a",
"State": "attached",

And let's call this one "Volume B":

"VolumeId": "vol-07ebxxx09e",
"Device": "/dev/sdb",
"InstanceId": "i-01a15xxx66a",
"State": "attached",

But on the instance itself, when I run these commands, the devices have completely different names...

ubuntu@ip-xxx-xx-xx-xxx:/$ df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs   63G     0   63G   0% /dev
tmpfs          tmpfs      13G  752K   13G   1% /run
/dev/nvme1n1p1 ext4      7.7G  3.1G  4.7G  40% /
tmpfs          tmpfs      63G     0   63G   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs      63G     0   63G   0% /sys/fs/cgroup
/dev/loop0     squashfs   29M   29M     0 100% /snap/amazon-ssm-agent/2012
/dev/loop1     squashfs   29M   29M     0 100% /snap/amazon-ssm-agent/2896
/dev/loop2     squashfs   56M   56M     0 100% /snap/core18/1885
/dev/loop3     squashfs   98M   98M     0 100% /snap/core/9993
/dev/loop4     squashfs   97M   97M     0 100% /snap/core/9804
tmpfs          tmpfs      13G     0   13G   0% /run/user/1000

ubuntu@ip-xxx-xx-xx-xxx:/$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0         7:0    0 28.1M  1 loop /snap/amazon-ssm-agent/2012
loop1         7:1    0 28.2M  1 loop /snap/amazon-ssm-agent/2896
loop2         7:2    0 55.3M  1 loop /snap/core18/1885
loop3         7:3    0 97.1M  1 loop /snap/core/9993
loop4         7:4    0 96.6M  1 loop /snap/core/9804
nvme0n1     259:0    0 1000G  0 disk 
nvme1n1     259:1    0 1000G  0 disk 
└─nvme1n1p1 259:2    0    8G  0 part /

So what confuses me here is the devices are named completely differently in AWS than on the instance itself. Which volume is "/dev/nvme1n1p1"? How can I be sure? Where can I look to see these values actually map together somehow?

EBS volumes are exposed as NVMe block devices on instances built on the Nitro System . The device names are /dev/nvme0n1 , /dev/nvme1n1 , and so on.

So just imagine in your case /dev/nvme0n1 being equivalent to /dev/sda

and eg /dev/nvme0n1p2 (which is your / root partition) being equivalent to something like /dev/sda2.

run below command to know volume id of your nvme1n1p1

sudo /sbin/ebsnvme-id /dev/nvme1n1

in your case may be

[ec2-user ~]$ sudo /sbin/ebsnvme-id /dev/nvme1n1p1

output -

Volume ID: vol-01324f611e2463981
/dev/sdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM