Monday, March 25, 2019

Identifying EBS Volumes in later versions of Linux - NVMe



So you have a Linux AMI using NVMe but you dont know how to map it to the AWS EC2 volumes


Solution


Lets list all our disks with fdisk ( or look at fstab)

fdisk  -l|grep Disk|grep \/dev

Disk /dev/nvme1n1: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/nvme2n1: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/nvme0n1: 12.9 GB, 12884901888 bytes, 25165824 sectors
Disk /dev/mapper/ol-root: 10.5 GB, 10515120128 bytes, 20537344 sectors
Disk /dev/mapper/ol-swap: 1287 MB, 1287651328 bytes, 2514944 sectors


we want to find out what , for example  nvme2n1 maps to 

yum install nvme-cli

nvme id-ctrl /dev/nvme2n1|grep sn 

[root@apps log]# nvme id-ctrl /dev/nvme2n1|grep sn
sn        : vol0a6f7c1217dda09f3
[root@apps log]#

You should then be able to go into your AWS control panel or API  and with that volid you will find the volume. 

Thanks ! 

Chris