How can I list the actual block-device name(s) of ephemeral storage available in my EC2 instance?
After some trials and errors, it appears that such devices are connected as /dev/xvdn
(and /dev/xvdm
if there are two) -- is there some way to reliably list them from inside the instance?
fdisk -l
lists all devices -- without anything obviously distinctive about /dev/xvdn
. Same goes for output of lsblk
. (We aren't using Amazon's own AMI-instances, so there is no -p
flag for lsblk
...)
Request for http://169.254.169.254/latest/meta-data/block-device-mapping/ephemeral0
returns sdj
, but there is no /dev/sdj
, so that seems useless... Is there anything better?
The minor device-number seems to be 208 -- can one rely on that?
I don't have the setup to check if this this specific to Amazon Linux AMIs, but on my setup here,
/dev/sdX
is symlinked to the corresponding/dev/xvdX
device.curl http://169.254.169.254/latest/meta-data/block-device-mapping/ephemeral0 --> sdb
The above is your best bet. The reason you don't see an
sdj
device is due to a discrepancy between how AWS refers to the devices they attach to your instance and how your OS names those devices. Amazon is saying that it'ssdj
, which in your case, is actually/dev/xvdj
.